I need to delete folders in a folder in one shot, and this folders start with a common name, but does not end with. So any command with del/rm to do this? I tried with wildcards but that didn't work.
c:\temp> rmdir hello*
--- directories with starting charecters as 'hello', didn't work
c:\temp> rmdir hello*.*
--- didn't work
You can do this using the Windows GUI. Enter "*. wlx" in the search box in explorer. Then after the files have been found, select them all (CTRL-A) and then delete using the delete key or context menu.
You can use standard UNIX or Linux rm command to delete a file name starting with - or -- . All you have to do is instruct the rm command not to follow end of command line flags by passing double dash -- option before -foo file name.
Note: If you want to remove a directory whose name starts with a hyphen (-), use the rm -- [directory name] or rm ./[directory name] syntax. Use the -r flag to delete a directory that contains subdirectories and files. The -i option displays a prompt asking you to confirm directory removal.
From the command line:
for /d %i in (hello*) do rd "%i"
In a batch file:
for /d %%i in (hello*) do rd "%%i"
Try this - remove the echo
if it works the way you expect it.
for /d %%a in (hello*) do echo rd /s /q "%%a"
change all %%a to %a to execute it from the command line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With