cd \"Main Directory" (quotes not needed if directory name has no spaces)Originally Posted by BlueGrimRX8
cd "dir 1"
del *.xls /q
cd..
cd "dir 2"
del *.xls /q
cd..
cd "dir 3"
del *.xls /q
cd..
exit
Hope that helps
I am trying to write a batch file that looks in all the directories withing a folder and deletes all the .xls files in all the folders.
So I have folder structure
Main Directory
-Dir 1
-Dir 2
-Dir 3
Inside each of those Dir's there are .xls files. I want to delete all of them, could someone help me write a batch file to do this?
Thanks!!
cd \"Main Directory" (quotes not needed if directory name has no spaces)Originally Posted by BlueGrimRX8
cd "dir 1"
del *.xls /q
cd..
cd "dir 2"
del *.xls /q
cd..
cd "dir 3"
del *.xls /q
cd..
exit
Hope that helps
cd\yourdirectory <------ This is the root of your directory structure
del *.xls /s
Put that in your batch file and it should work.
Thanks,
Paul.
Ford Transit 135 T350
1Ghz Epia M10000 ITX
OPUS 150w
512MB DDR
40GB HD
7" Lilliput Touch Screen (Powered from Opus)
0% Completed - Used to have this PC in my Ford Focus RS for fun but now I have it in my van for work! It's awsome!
Thanks paul thats exactly what I was looking for. Eleventh, that would have worked to but I have over 2000 subdirectories.
Thanks guys knew somebody could help!!
Originally Posted by BlueGrimRX8
Gotcha - I didn't know if there were some directories in Yourdirectory that you didn't want to delete the .xls's in, that's why I didn't reccommend /s. Happy coding.
Incidentally, if you want to turn your bacth file in to an exe check this out: http://www.bdargo.com/index.htm
Bookmarks