sem1845 Posted January 21, 2011 Posted January 21, 2011 What's the easiest way to do this? I'm wanting to clean up my music collection some. Quote
Sparda Posted January 21, 2011 Posted January 21, 2011 You could write a simple script to traverse all the folders and build a list of empty ones, or just have it delete them automatically. Quote
Jason Cooper Posted January 21, 2011 Posted January 21, 2011 What's the easiest way to do this? I'm wanting to clean up my music collection some. You can use find to do this. find /path/to/search/from -type d -empty Find will be on most Unix style systems and you can get a win32 version for windows. Quote
digip Posted January 21, 2011 Posted January 21, 2011 Use Jason Cooper's method above for *nix like systems, but if you have windows Vista or Windows 7 then you should already have powershell installed. Try: http://technet.microsoft.com/en-us/library/ff730953.aspx For all windows 95 through 7 systems you can also use the DIR command, listing smallest files first (after initial folder listing, then sub directories show up), but this tends to be messy and scrolls off screen Best to pipe it to a text file so you don't lose what scrolls off the screen if there are hundreds of folders to sort through. The ones that say 0 bytes, are generally empty folders, just open them to make sure before deleting: dir /s /os > list.txt Then open list.txt and scroll down till you start seeing the folder sizes large than 0 bytes. Anything below that has files and isn't empty. Quote
hexophrenic Posted January 21, 2011 Posted January 21, 2011 To add to what digip said: Modify the list.txt file to include only 0-sized directories and skip the verification step. Write a batch file with a for /f loop using rmdir...it will error out on directories that are not empty. Pipe the output of the command to a text file and review for errors. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.