deleting all contents of a folder from command prompt...

  • Thread starter Thread starter GO
  • Start date Start date
G

GO

I want to be able to delete the entire contents of a folder (including
subfolders) from the command line but leave the main folder intact. I've
been using deltree (copied over from my Win98 days) up until now but would
like to find a better way to do it. I know of the rd command, but that
removes the main folder as well as all contents. Is there any tool out
there that might do the trick?

TIA,

Greg
 
Hi,

Do it (RD) from within the folder, or use ERASE and set the path to the
folders to be removed.

--
Best of Luck,

Rick Rogers, aka "Nutcase" - Microsoft MVP

Associate Expert - WindowsXP Expert Zone

Windows help - www.rickrogers.org
 
rd will only work with a folder name, so I'd have to specify each folder
within my main folder. And it could possibly leave files within my main
folder. Erase/del will not remove subfolders (however, it will remove files
within the folders).
 
Yeah, I thought of that but it's not the best solution. Sometimes
files/folders are in use when trying to purge the folder(s). Looks like I'll
just continue using deltree. ;)
 
Back
Top