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

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
 
R

Rick \Nutcase\ Rogers

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
 
J

Jon

Could use a combination of rd with md
ie recreate the original directory post delete

Jon
 
G

GO

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).
 
G

GO

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. ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top