lkane Posted August 25, 2010 Report Share Posted August 25, 2010 I have a large directory structure that contain many zip files. In order to free up some space, I want to delete any unzipped files. I wrote a batch file that works OK. It looks for all zips and executes rmdir for every file name minus the extension. (a little sloppy but gets the job done) The problem is, it misses any zips contained in folders that have spaces in the name. I know quotes are needed.... anyway, heres what I'm using:FOR /f %%A IN ('dir /B /S "*.zip"') DO rmdir /S /Q "%%~dpnA" It cuts off anything beyond a space even thoumgh the executed rmdir commands show quotes around the directory names.any ideas? different approaches to my problem?being able to remove all spaces in the directory names or replace them with an underscore would also work. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.