Empty Folders

I have the trial of Dopus, I want to know if there is a way to search for only empty folders on a drive so they can be deleted.

Read this thread.

As far as I know Opus does not have a method to find empty subdirectories by searching for size as I think every directory has a minimum size assigned to it by Windows.

However if you're on speaking terms with batch files, you could create one with the following script and launch it from an Opus button to return a list of empty subdirectories.

for /f "delims=*" %%a in ('dir /a:d/b/s') do (
dir "%%a" /a:-d >nul 2>nul
if errorlevel 1 echo %%a

How would I launch the .BAT file within Opus

First create and save your .BAT file then in Opus navigate to where you saved that batch file. Put Opus into customize mode, left click on the batch file, and drag it to an empty spot on any toolbar or menu. That will create a new button for you that will run the batch file (after you tweak the button configuration a bit). With Opus still in customize mode, double-click the new button you just made (to edit it) and goto ADVANCED MODE. Set the button function type to:


Exit customize mode and give it a go.

The script can be refined to be more reliable but as it is it should list all the empty subdirectories of the current folder you have Opus in.

Just a little follow up here on this. If you're having problems making my above suggestion work, I won't be surprised. I wrote the above on the fly and after double checking it later tonight I see there are some ways it will fail. The principle is valid though, so shout if you still need some help on finding empty subdirectories.

But don't shout too loud tonight because I'm going to bed and I need all the uninterrupted beauty sleep I can get.

The Flat-View, sort by size method works really well unless there are really huge numbers of files below the point you're scanning so that it takes forever just to turn flat view on.

(Just remember to remove the Description column and anything else that would trigger actually opening and inspecting the files, so that the disk isn't tied up after the directory listing comes back, although you can use the file list as soon as the listing is done as the Description column (etc.) is populated in the background.)

Empty means the folder is literally empty. "0 bytes" means the folder contains other folders, or zero-byte files, that still add up to zero bytes. You can use the Total File Count and Total Sub-Folder Count columns if you care about the distinction.

1 Like
  1. Create a button (Right Click on toolbar and customize)
  2. label the button
  3. FUNCTION should be set to "Standard Function (opus or external)
  4. Click on Advanced Options
  5. paste the following code
cd "{sourcepath}"
cmd /k "for /f "delims=" %d in ('dir /s /b /ad ^| sort /r') do rd "%d""
  1. Click ok, ok.

you can now click the button to delete all empty folders and subfolders in the current directory.