Batch File Help ASAP

sean82007

Baseband Member
Messages
87
Alright Im trying to create a program that deletes all the .mp3 files in a certain folder. But whenever I typed the location, it says could not find the specified location or file. Heres the code.

@ECHO OFF
PAUSE
ECHO This deletes all your mp3 files within ur My Documents folder!!!
PAUSE
ECHO Press any key to continue.....
C:\My Documents\My Music
ECHO Deleting Files
del *.mp3
ECHO Your computer is now clean from mp3's!!!
PAUSE

I just started coding with batch about 2 days ago. But I need help please. Could u help me.

---- This is what it says when I execute the prog!!! ----

Press any key to continue ...
This deletes all of your mp3 files within ur My Documents folder!!!
Press any key to continue...
Press any key to continue.....
'C:\My' is not recoginized as an internal or external command,
operable program or batch file
Deleting Files
Could Not Find C:\Documents and Settings\Owner\My Documents\*.mp3
Your computer is now clean from mp3's!!!
Press any key to continue...

--- Please Help ---
 
I think the problem is you are changing directories in one line.
Because of the space in the my documents folder you are effectivly trying to run c:\my as if it were an excecutable file (c:\my.exe).
you could try changing the line
c:\my documents\my music
to
c:
cd my documents\my music\

another thing you might be interested in would be changing the line del *.mp3 to
del *.mp3 > deletedmp3s.txt
This will create a new text file detailing all the files deleted.
(hope this helps)
 
You may have already checked, but I'll tell you this to make sure:
Is your My Documents folder in your C: drive? or is it in something like c:\documents and settings\administrator\my documents\my music

Also, the other problem could be with the [space]'s in the address. You can try putting in what root said above, though I haven't tried that. Also, you can try something like C:\DOCUME~1\, but I don't know what the other folders are called after that

Good luck :)

Itsme
 
OK,
in that case a little bit more information is needed, I tired out the lines I wrote in your batch file before I posted then in windows XP, it might be that you are using a different version of windows, or something else is a little differnet, could you post the batch file here again, and post the results here.

you could also try writting the batch file line by line into the command prompt to see where it goes wrong.
 
Back
Top Bottom