Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

WAD [Discrepancy] Have rmdir work like described in the docs

Jun
223
0
The docs for rmdir state:

"File Selection
Supports command dialog, extended wildcards, ranges, multiple file names, and include lists."


Unfortunately wildcards (and maybe others) are not supported, so that e.g.

rmdir /qs hsperfdata_*

fails with

TCC: (Sys) The directory name is invalid.
"D:\temp\hsperfdata_*"
 
Last edited by a moderator:
It's the "/s". See the help. It's dangerous enough by itself. I'm not surprised that it expects the name of a directory.

It's easy enough to get around:

Code:
do dir in /a:d hsperfdata_* ( rmdir /qs %dir )
 
It sounds like you're cleaning %TEMP. Do you get directories with names like "de96df7b3a4f5ed2f1e9f6375e785c90", i.e., 32 hex characters?

I do, and though I don't know who creates them, I know from experience that they can be deleted safely. It took a while, but I just cooked up this command which might be useful in a CLEANTEMP.BTM.
Code:
do dir in /p dir /a:d /b /ne ::"^[0-9a-fA-F]{32,32}$" ( rmdir /q /s %dir )

Apparently, you can't give DO a regex file spec ... too bad.
 
@vefatica

I'd like to replace some of MSys's "rm -rf ..."s - which sadly are much slower than "del" (which is not the fault of "rm" but that of MSys). Using your method would require me to replace quite a lot of "rm -rf" commands with the above mentioned "do" command which seems quite a bit of overhead to me. And yes, it's possibly dangerous - but that's my problem ;-); btw. the ones of us still using the "good ol' command line" are surely aware of this...

Anyway, either the docs are wrong, or the command.
 
Ran into the same thing today cleaning up a folder tree I was playing with. However, by changing the command slightly (from "*" (asterisk) to "." (dot)) it did an override of the wildcard limitation. It even prompted me with a wildcard...

Code:
[C:\test] $ dir

 Volume in drive C is unlabeled      Serial number is 262b:d729
 Directory of  C:\test\*

 9/20/2016  11:32         <DIR>    .
 9/20/2016  11:32         <DIR>    ..
 9/20/2016  11:33         <DIR>    dir1
 9/20/2016  11:33         <DIR>    dir2
 9/20/2016  11:34         <DIR>    dir3
                   0 bytes in 0 files and 5 dirs
      66,485,268,480 bytes free

[C:\test] $ rd /s *
TCC: (Sys) The directory name is invalid.
 "C:\test\*"

[C:\test] $ rd /s .
C:\test\* : Are you sure (Y/N)? Y

[C:\test] $ dir

 Volume in drive C is unlabeled      Serial number is 262b:d729
 Directory of  C:\test\*

 9/23/2016   9:53         <DIR>    .
 9/23/2016   9:53         <DIR>    ..
                   0 bytes in 0 files and 2 dirs
      66,493,485,056 bytes free
 
Back
Top
[FOX] Ultimate Translator
Translate