Forum Home
Press F1
 
Thread ID: 41421 2004-01-10 21:53:00 Delete folders with spaces in name MakeItSo (2451) Press F1
Post ID Timestamp Content User
206531 2004-01-10 21:53:00 I am using a batch file to delete subfolders on a W2K server using rmdir /s. It works fine except that some users create subfolders with spaces in the name and rmdir treats the space as a delimiter thus failing. I am using a wildcard to delete the folders so quotes will not work. Does anybody know of a way around this. The batch file is reproduced below.

FOR /F %%A IN (Arglist.txt) DO FOR /D %%N IN (E:\users\%%A\*) DO rmdir /s %%N

Arglist.txt contains the names of folders substituted for %%A. These folders never change.

Thanks.
MakeItSo (2451)
206532 2004-01-10 22:11:00 My CLI (command line interface) skills are a bit rusty but have you tried looking into getting the subdir names enclosed in quotes? Tom McB (832)
206533 2004-01-10 23:52:00 If the folders you want to delete are pre-listed in arglist.txt, then change the folder names in arglist.txt like this:

If foldername = "mike folder"
then 8.3 foldername = "mikefo~1"

If foldername = "Make It So"
then 8.3 foldername = "makeit~1"

And so on.

Mike.
Mike (15)
1