Jump to content

How To Find Empty Folders?


sem1845
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...