[Windows] Remove Empty Folders
Posted: September 4th, 2008, 2:14 am
This code will allow you to Remove Empty Folders
Explanation: Scans for folders that are empty. Sorts them in Reverse to allow multi nested Empty Folders to be removed.
Example: C:\Downloads\TV\DVD\ Scanning from DIR C:\Downloads\. TV and DVD contain no files and or only contain other folders that are also empty... DVD will be deleted first then TV.
Just change the CHANGEmeTOyourCompletedFolderPATH to what it says and leave everything else the same.... Bingo!
For some reason I just love SABnzbd
Explanation: Scans for folders that are empty. Sorts them in Reverse to allow multi nested Empty Folders to be removed.
Example: C:\Downloads\TV\DVD\ Scanning from DIR C:\Downloads\. TV and DVD contain no files and or only contain other folders that are also empty... DVD will be deleted first then TV.
Just change the CHANGEmeTOyourCompletedFolderPATH to what it says and leave everything else the same.... Bingo!
Code: Select all
@echo off
echo.
echo [Removal] EMPTY Directories
for /f "usebackq delims=" %%V in (`"dir CHANGEmeTOyourCompletedFolderPATH /ad/b/s | sort /R"`) do rd "%%V"