FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 



Delete Empty Folders via Command Prompt

 
Post new topic   Reply to topic    [TweakNews.net Forum] Forum Index -> Tweaks & Tips
View previous topic :: View next topic  
Author Message
jadison
Guest





PostPosted: Mon Jan 20, 2003 2:13 am    Post subject: Delete Empty Folders via Command Prompt Reply with quote

Here's a good way to find and delete all those empty folders & subfolders on your system, cleaning up things a bit, via the command prompt.

This goes for Win9x/Me/2k/XP: open up a command prompt window and navigate to the root folder of the drive in question. Enter this command:
DIR /AD/B/S | SORT /R > EMPTIES.BAT

The file EMTPIES.BAT now contains a list of all folders on your HD in reverse order. Use Word or another editor to add the prefix RD (with a space after RD) to every line in the file. In Word, you can do this easily by using Find and Replace to search for ^p (which represents the paragraph mark) and replace it with ^pRD , then hand-correct the first and last lines of the file if necessary. Save the modified EMPTIES.BAT file and exit your editor. Then simply launch the batch file. It will attempt the RD (remove directory) command on each folder, but the command will fail for any folder that isn't empty.

There ya go!
Back to top
Google
Sponsor





PostPosted: Mon Jan 20, 2003 2:13 am    Post subject: Advertisement

Back to top
Display posts from previous:   
Post new topic   Reply to topic    [TweakNews.net Forum] Forum Index -> Tweaks & Tips All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB3 ©