1.

Solve : Search subfolders for filename!?

Answer»

Hey GUYS!

- I hope someone is able to answer this.


I'm trying to create a batch program which can sort my music library. So far I've come up with this code:

Code: [Select]:A
set /P ARTIST1=Artist 1:
if exist *%ARTIST1%*.mp3 (
md C:\Users\%username%\Desktop\TEST!\"%ARTIST1%"
xcopy "C:\Users\%username%\music\*%ARTIST1%*.mp3" "C:\Users\%username%\music\%ARTIST1%"
DEL *"%ARTIST%"*.mp3
If %antal%==1 goto A

I've placed this file in my music folder - and the problem is that this file only searches the music folder - but not all of my subfolders.

How can i make the batchfile search BOTH the music folder and all subfolders for the artist name? Search current directory and subdirectories with dir /s *.mp3

C:\>dir /?

/S Displays FILES in specified directory and all subdirectories.



%homepath%\My Documents>dir /s *.mp3

Directory of %homepath%\My Documents\My Music

04/05/2009 04:49 PM 311,257 reveille.mp3
06/24/2008 12:34 PM 168,064 TAPS.mp3
2 File(s) 479,321 bytes

Directory of %homepath%\My Documents\My Music\iT
unes\iTunes Music

04/05/2009 04:49 PM 311,257 reveille.mp3
10/19/2009 04:14 PM 172,129 TAPS.mp3
2 File(s) 483,386 bytes

Total Files Listed:
4 File(s) 962,707 bytes
0 Dir(s) 304,299,802,624 bytes free

%homepath%\My Documents>



Discussion

No Comment Found