Delete all empty folders?

Is it possible to create a button that deletes all empty folders that are in current directory? Would be very useful I think...

There are a couple of few ways to do it, described here:

[Empty Folders)

I use Flat View myself (as described in my reply to that thread).

Found a little DOS app that I use called rmempty.exe that I have tied to a Button in DOpus. Once launched it will start scanning your Source Lister and all sub folders, removing any empty folders it finds.

To setup:

Extract the zip into folder C:\Program Files\GPSoftware\Directory Opus\bin\

Create new button using the following DOS Batch code;

@echo off&color 0b&cls
echo --------------------------------------------------
echo D I R E C T O R Y  O P U S - R M E M P T Y D I R
echo For DOpus v9.x
echo --------------------------------------------------
"C:\Program Files\GPSoftware\Directory Opus\bin\RMEMPTY.EXE" {sourcepath}
echo -[done]-
ping -n 5 > nul

Have any problems, just let me know. (36.1 KB)

Thanks for that MtDew12oz, I must admit it never occurred to me to use another program to do it. Works perfectly, but the dos box that pops up is kind of annoying. By the way, what's the ping to localhost for?

The ping localhost is a common DOS trick for inserting a delay into batch files, since there isn't an explicit "delay" command out-of-the-box.

After playing around with this I found you can do it without the batch script and run it as a function then use run mode Hide. Works fine with no DOS window. My preference is to see what’s going on, but if you don't care about it, hiding the window seems to work just fine.

Just add this:

<button display="both">
	<label>Del Empty Dir</label>
	<function type="normal">
		<instruction>@runmode hide</instruction>
		<instruction>&quot;C:\Program Files\GPSoftware\Directory Opus\bin\RMEMPTY.EXE&quot; {sourcepath}</instruction>

Hi everyone,

related to this discussion I have a similar question:

Is it possible to simply find and list all empty folders within a directory?

Self-scripting or even better any DOpus buttons that I haven't found are greatly appreciated as I am hunting down some weird data-erasing problem on my computer.


Using a filter like that in Tools > Find > Advanced will net you empty folders (and folders which only contain other empty folders and zero-byte files; calculating folder sizes on the results (Edit > Calculate Folder Sizes) or adding columns to show subfile/subfolder counts can be used if you only want literally empty folders). ... _Types.htm

You're awesome - thanks for the instant reply!

  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.