Skip to content

Delete empty directories in Windows & Linux

If you often work with downloads like mods for video games, movies or TV shows, you may move all needed files into one folder. In that aftermath, you then have a lot of empty folders and are not sure anymore which actually still contain files or not. Luckily, there exists both commands on Linux and on Windows.

In both cases, open up a Terminal/Command prompt window and run the following command in the directory where your empty folders are located:

Linux command:

find . -type d -empty -delete

Windows command (Doesn’t work in PowerShell):

for /f "delims=" %d in ('dir /s /b /ad ^| sort /r') do rd "%d"



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.