How do I find all the empty folders and delete them.

Anonymous
2011-04-03T17:52:58+00:00

My music has a bunch of folders that are empty but it will take forever to look at every single one.  I want to search by size or someway that will make it easier to find and delete

Windows for home | Previous Windows versions | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
Anonymous
2011-05-15T16:05:51+00:00

Hello !

If you do want to delete all the empty folders only ! go to Computer and at the top right click on search. Click on kind and Select folder, now click again on search and click on size, select 0 and click on search.

This should list all the empty folders

Regards

Was this answer helpful?

800+ people found this answer helpful.
0 comments No comments

55 additional answers

Sort by: Most helpful
  1. Anonymous
    2016-02-02T09:04:48+00:00

    The -Directory parameter was introduced in PowerShell 3.0. This command should work for older versions of PowerShell:

    dir -Recurse | where {$_.PSIsContainer -and ($_ | dir).Count -eq 0} | rmdir

    Source: Stack Overflow

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. Anonymous
    2016-01-29T09:48:23+00:00

    I tried running this in Windows 7 but got error, I then tried running it like this:

    for /f "usebackq" %d in ("dir /ad/b/s | sort /R") do rd "%d"

    only got error:The system cannot find the file specified.

    It seemed to error out on all directories with spaces even with "%d". The quote would be at the space and truncate the full directory name.

    Any help would be much appreciated. Thank You for you support!-)

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  3. Anonymous
    2015-09-15T13:47:57+00:00

    For James,

    Under CMD at root c: \

    DIR /AD/B/S | SORT /R > DIR-empty.BAT

    The DIR-empty.BAT file will contain the list of all empty directories

    on the «C» hard disk. This list will be sorted in a reverse order.

    Open this file with a good ASCII editor

    and put every line between « " »

    and add   RD infront of each line

    Then go back to the root and run DIR-empty

    Regards

    Roger

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2014-03-11T19:58:44+00:00

    Delete Empty Folders and Subfolders

    Open the CMD: 

    1. Hold Windows key and press R
    2. Navigate to the C:\ directory, type "cd C:" without quotes then press enter.

    Should look like this C:>

    1. Type or copy and paste this command where your prompt is blinking:

    DIR /AD/B/S | SORT /R > EMPTIES.BAT   

    1. then press enter and wait,,, DONE

    You can copy this into a notepad text file and save it to use whenever needed.

    You'd be amazed at how many empty folders are on your HDD causing windows to 

    slow down at boot times and searches!

    Was this answer helpful?

    0 comments No comments