Please tell me I'm over-thinking this!
You're over thinking this! :) Or rather, going about things the hard way.
Assuming the command you gave does what you need everywhere bar Windows, just use this when you detect Windows:
system qq[ for /d %d in ($tmp\\scale-*) do @rd /q /s %d ];
Eg:
C:\test>dir /b /s ppp C:\test\ppp\donttouch C:\test\ppp\scale-123 C:\test\ppp\scale-124 C:\test\ppp\scale-125 C:\test\ppp\donttouch\junk.1 C:\test\ppp\scale-123\junk C:\test\ppp\scale-123\junk\junk.1 C:\test\ppp\scale-123\junk\junk.2 C:\test\ppp\scale-123\junk\junk.3 C:\test\ppp\scale-124\junk C:\test\ppp\scale-124\junk\junk.1 C:\test\ppp\scale-124\junk\junk.2 C:\test\ppp\scale-124\junk\junk.3 C:\test\ppp\scale-125\junk C:\test\ppp\scale-125\junk\junk.1 C:\test\ppp\scale-125\junk\junk.2 C:\test\ppp\scale-125\junk\junk.3 C:\test>for /d %d in (ppp\scale-*) do rd /q /s %d C:\test>rd /q /s ppp\scale-123 C:\test>rd /q /s ppp\scale-124 C:\test>rd /q /s ppp\scale-125 C:\test>dir /b /s ppp C:\test\ppp\donttouch C:\test\ppp\donttouch\junk.1
Why reinvent an operation that the OS already knows how to do?
In reply to Re: removing directories with wildcard glob in OS-portable way
by BrowserUk
in thread removing directories with wildcard glob in OS-portable way
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |