Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Help Needed with Searching File/Folder/Move .Bat file

29 Apr 2012   #11
Duzzy

Windows 7 Ultimate x64
 
 

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 System SpecsSystem Spec
.
29 Apr 2012   #12
Gunslinger2

Windows 7 Ultimate x64
 
 

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 System SpecsSystem Spec
29 Apr 2012   #13
Duzzy

Windows 7 Ultimate x64
 
 

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 &&
Quote:
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.
My System SpecsSystem Spec
.

30 Apr 2012   #14
Gunslinger2

Windows 7 Ultimate x64
 
 

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.


Attached Files
File Type: txt 0Songs2Organize.txt (59.1 KB, 10 views)
File Type: zip Artist.zip (69.2 KB, 7 views)
My System SpecsSystem Spec
01 May 2012   #15
Duzzy

Windows 7 Ultimate x64
 
 

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...

Quote   Quote: Originally Posted by Gunslinger2 View Post
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.


Attached Files
File Type: bat Artist.bat (2.0 KB, 8 views)
File Type: vbs FindReplace.vbs (706 Bytes, 6 views)
My System SpecsSystem Spec
01 May 2012   #16
Gunslinger2

Windows 7 Ultimate x64
 
 

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 System SpecsSystem Spec
01 May 2012   #17
Gunslinger2

Windows 7 Ultimate x64
 
 

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.
My System SpecsSystem Spec
02 May 2012   #18
Gunslinger2

Windows 7 Ultimate x64
 
 

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 System SpecsSystem Spec
02 May 2012   #19
Duzzy

Windows 7 Ultimate x64
 
 

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 System SpecsSystem Spec
Reply

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




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Can move only one file at a time within same folder or get error msg
I often need to reorganise files and sub-folders within the same main folder, for example, move folder from sub-folder named documents to sub-folder named photos. However Explorer in Windows 7 Professional will only allow me to move one folder at a time. When I try to move a second folder I get the...
General Discussion
Can't rename, delete or move folder or file
Since 2 days, in a certain folder, I cant rename, move or delete folders or files. Now, it has spread to my desktop as well. If I rename a folder, even a new folder, the name changes ''magically'' within seconds to restore to its previous name. If I move the folder or file, it comes back and if I...
BSOD Help and Support
Batch file to move (many) duplicted folder contents - Help!!
Hope I can explain my difficulty. I have duplicated folders album name for all my music files. As there is quite a considerable number I wondered if it was possible to batch file (automate) the process. I can not delete "d" as this would delete all the tracks. What I need to do is move the...
General Discussion
how to move file in folder
before you reinstall w7 files in folders can be moved example files beginning with the letter A, which is the top of the folder can be moved at the bottom closing and opening the folder remains the all clear but now sit as "glued" from where they waved box to be able to move
Customization
BSOD while 'Move File to Folder' option
hi guys. approximately 10 minutes ago, i was moving a 1.1GB mkv file from one of my partitions to a harddrive connected to my computer via the USB port. my system ; win 7 ultimate 32bit intel q9550 gigabyte EP43-UD3L 2x2GB corsair dominators ddr2 1066mhz all stock, no raids, no...
BSOD Help and Support


Our Sites

Site Links

About Us

Find 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 21:56.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App