I have a .bat that runs at Startup. I want to add an extra process that deletes folders in a specific directory. The target folders will have been renamed with something like ".orph" appended at the end.
I have this for starters:
for /d "delims=" %%p in ("C:\Users\) do rmdir "%%p" /s /q
but I don't know how to specify the .orph identifier.
Help greatly appreciated, thank you.
Folder Deletion
Moderator: DosItHelp
Re: Folder Deletion
It's not quite clear to me what you're trying to do. However, you could try something like that:
Update the path after the /r option accordingly and run it. The script doesn't do any harm yet, it only displays the commands that would be executed. If you think that the right folders are found, remove the ECHO command and run the script again to actually delete the folders.
Steffen
Code: Select all
@echo off
for /d /r "C:\Users\user\somewhere" %%p in ("*.orph") do ECHO rmdir "%%p" /s /q
PAUSE
Steffen