rmdir Command Generator
Generate rmdir commands to remove empty directories
Getting Started with rmdir
## What is rmdir?
The `rmdir` command removes **empty** directories. It refuses to touch a directory that contains any files or subdirectories, which makes it a safe way to clean up folder structures without accidentally deleting data.
## How to Use
1. **Enter Directory**: Provide the path of the empty directory to remove (required). 2. **Pick Options**: Use `-p` to remove ancestor directories, `-v` to see what happens, or `--ignore-fail-on-non-empty` to skip non-empty silently. 3. **Copy & Run**: Copy the generated command into your terminal.
> To remove a directory that contains files, use `rm -r` instead. `rmdir` will fail on any non-empty directory.
Common Options
### `-p` Parents Remove the directory and its now-empty ancestors. For `rmdir -p a/b/c`, `rmdir` removes `c`, then `b`, then `a` if each becomes empty.
### `-v` Verbose Print a message for every directory processed — helpful when chaining `-p` over several levels.
### `--ignore-fail-on-non-empty` Suppress the error for non-empty directories. `rmdir` still removes any empty directories in the list and exits silently for the rest. Useful when cleaning up a mixed batch.
▶How do I remove a directory that isn't empty?
▶How do I remove a whole empty path like a/b/c at once?
▶Why does rmdir report 'Directory not empty'?
If this tool has been helpful to you, consider buying me a coffee.
Buy me a coffee