Help Needed with Searching File/Folder/Move .Bat file

Page 2 of 2 FirstFirst 12

  1. Posts : 640
    Windows 7 Ultimate x64
       #11

    New and improved code.
    If your text files are named as the artist and the way you want the subfolder to read then use this
    Code:
    @echo off
    
    for /f "tokens=1,2 delims=." %%i in ('dir /b C:\Artist\*.txt') do (call :COPY_FILES "C:\Artist\%%i.%%j" ".\%%i\*.*")
    
    exit
    
    :COPY_FILES
    for /F "usebackq delims==" %%G in (%1) do xcopy /qv "%%Glyricschords.*" %2
    No need to create a line for each artist it uses the text files name as the artist name.
    I've only given code to copy the files to subfolders because it's easier than the move command.

    BTW the text files should be located in C:\Artist and again run this from the folder containing the files to copy. This is based on your list formatted as

    fortyhourweek
    hatsoff
    hangingupmytravelingshoes

    if they are like

    fortyhourweeklyricschords.html
    hatsofflyricschords.html
    hangingupmytravelingshoeslyricschords.html

    then replace "%%Glyricschords.*" with "%%G"
    with this code all list will need to be in the same format.
      My Computer


  2. Posts : 25
    Windows 7 Ultimate x64
    Thread Starter
       #12

    using this:
    Code:
    @echo off
    
    for /f "tokens=1,2 delims=." %%i in ('dir /b C:\Artist\*.txt') do (call :COPY_FILES "C:\Artist\%%i.%%j" ".\%%i\*.*")
    
    exit
    
    :COPY_FILES
    for /F "usebackq delims==" %%G in (%1) do xcopy /qv "%%Glyricschords.*" %2
    as it is much faster but is there a way to delete the original file so that only the copy located within the artist folder exist?
      My Computer


  3. Posts : 640
    Windows 7 Ultimate x64
       #13

    I could see why that would be handy. Just change the last line to this

    for /F "usebackq delims==" %%G in (%1) do xcopy /qv "%%Glyricschords.*" %2 && del /q /f "%%Glyricschords.*"

    bit of info on &&
    Use to run the command following && only if the command preceding the symbol is successful. Cmd.exe runs the first command, and then runs the second command only if the first command completed successfully.
    Last edited by Duzzy; 29 Apr 2012 at 23:10. Reason: Added lyricschords where needed
      My Computer


  4. Posts : 25
    Windows 7 Ultimate x64
    Thread Starter
       #14

    ok, the above code is working flawlessly for the most part for which I am grateful, however I've hit a snag.

    Originally I had 3 txt documents titled: GospelCountry, LatestAdditions & Bluegrass
    I've copied all the songs into one document called 0Songs2Organize.txt.

    This file has 1535 songs.....

    As it stands I have 103 Artist .txt files (i.e. Alabama etc. etc.)

    I need a simpler/faster way to go through 0Songs2Organize.txt, get the artist name & song because as of this moment I'm having to sit and read/search for the artist, song, copy & paste to the corresponding Artist.txt file then remove the "By "Artist"", turn everything to lowercase and remove all the spacing....manually . Using Notepad++ makes some of this easier but heh...not enough..

    I've also tried grouping the songs by artist in the 0Songs2Organize.txt and then copying & pasting to the appropriate Artist.txt but again it's time consuming to cut 'n paste scrolling up and down 1500+ lines grouping by artist

    Is there any way to ...for the lack of a better term "parse" the 0Songs2Organize.txt file so that it groups by the artist then I could just copy & paste to the correct Artist.txt file?

    Any solution would probably be a better one than the way I'm currently having to do this so any feedback or help is appreciated.

    -Note-
    Uploaded 0Songs2Organize.txt & artist.zip (contains all current artist.txt files created) for examples.
    Help Needed with Searching File/Folder/Move .Bat file Attached Files
      My Computer


  5. Posts : 640
    Windows 7 Ultimate x64
       #15

    Sorry for the late reply but it took a little to get something I think will work, well it's the best I can come up with anyway. It's still a hassle and also a 2 stage approach.

    Create a folder and put the 0Songs2Organize.txt and the FindReplace.vbs script in it. A sample batch file and the VBScript are attached.

    VBScript came from - VBScript Search and Replace

    Create a batch file with the following code or start with my sample.
    Code:
    set STRING=
    findstr /i /c:"%STRING%" ".\0Songs2Organize.txt"> ".\Artist\### %STRING%.txt"
    findstr /i /v /c:"%STRING%" ".\0Songs2Organize.txt"> 0Songs2Organize1.txt
    del ".\0Songs2Organize.txt"
    ren ".\0Songs2Organize1.txt" "0Songs2Organize.txt"
    cscript FindReplace.vbs ".\Artist\### %STRING%.txt" "%STRING%" ""
    cscript FindReplace.vbs ".\Artist\### %STRING%.txt" " " ""
    Now to use this you need to open 0Songs2Organize.txt and copy "by Artist Name" or "Artist Name" for the ones that don't have "by" in front and paste to the batch file so it looks like, set STRING=by Artist Name

    If the "by Artist Name" has the "&" char in it, like "by carl & pearl butler" then it will need to be put in as, STRING=by carl ^& pearl butler.

    You can do several at a time. Each time the batch runs it will remove the line from 0Songs2Organize.txt to make it easier to do the ones you havn't already done.

    Don't worry about the Artist.txt filename yet we'll get to that just see how you go with this for now.

    To be continued...

    Gunslinger2 said:
    I'm having to sit and read/search for the artist, song, copy & paste to the corresponding Artist.txt file then remove the "By "Artist"", turn everything to lowercase and remove all the spacing....manually
    Here I'm not sure about "turn everything to lowercase".
    Are you talking about the text inside the Artist.txt file or do you mean Uppercase each name in the Artist.txt filename?

    For the former I think were fine because DOS ignores cases with most things or use a switch to ignore also I couldn't see any uppercase in 0Songs2Organize.txt anyway and for the latter we'll get to that when we continue.
    Help Needed with Searching File/Folder/Move .Bat file Attached Files
      My Computer


  6. Posts : 25
    Windows 7 Ultimate x64
    Thread Starter
       #16

    Update, spent majority of last night/this morning separating, organizing artist with songs via spreadsheet.

    Currently have a folder C:\Artist\*.txt - * = Artist that contains all the artist.txt files (used .bat file)
    Code:
    @echo off
    for /f "tokens=1,2 delims=." %%i in (C:\songtools\Artist.txt) do (echo %%i >> %%~ni.txt)
    pause
    ......[Long period of thinking goes by]

    I was going to say something but I'm going to semi start over here, after a few days of grinding away at this (sometimes with little to no sleep) I have files everywhere & I need to get a little organized with what I'm doing because I'm starting to confuse myself & lose track of what I'm doing.

    Will update in a few hours....
      My Computer


  7. Posts : 25
    Windows 7 Ultimate x64
    Thread Starter
       #17

    9 hours now on and off I've been working on organizing a Google Doc spreadsheet containing all relevant info to this project.

    [URL Removed]

    ....and still editing it. Should be easier to come up with a game plan to create a .bat file or script to organize everything with all the information in one place.
    Last edited by Gunslinger2; 02 May 2012 at 06:21. Reason: removing URL
      My Computer


  8. Posts : 25
    Windows 7 Ultimate x64
    Thread Starter
       #18

    Marking as [SOLVED]

    Appreciate all the help Duzzy but the long hours attempting this and the Google Spreadsheet having a major malfunction and becoming FUBAR was the straw the broke the camel's back.
      My Computer


  9. Posts : 640
    Windows 7 Ultimate x64
       #19

    Ok. If you get into it again at a later date just continue this thread if you would like more help.

    If you want to organize artist with songs via spreadsheet I recommend downloading OpenOffice and save regularly creating a backup each time you save so you always have a 2nd copy if the 1st gets corrupted.

    OpenOffice spreadsheet app is called Calc.
      My Computer


 
Page 2 of 2 FirstFirst 12

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 22:10.
Find Us