[Windows] Remove Empty Folders

Come up with a useful post-processing script? Share it here!
Post Reply
EvilSIN
Newbie
Newbie
Posts: 3
Joined: August 22nd, 2008, 8:45 pm

[Windows] Remove Empty Folders

Post by EvilSIN »

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!

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"
For some reason I just love SABnzbd  ;D
Post Reply