Delete empty directories with find
find -type d -empty lists directories containing no files or subdirectories; pair it with -delete (or -print first) to clean them up safely.
01Command
$ find ~/Downloads -type d -empty -print02What it does
After moving files out of a synced or unpacked tree, dozens of hollow directories often remain. `find -type d -empty -delete` removes only truly empty ones — it cannot delete a directory that still contains anything. Note that deleting inner empty dirs can make their parents empty too, so run the command twice, deepest first (find does this naturally by processing depth-first).
03Risk
04Undo
$ null05Sources
- find(1) — search for files in a directory hierarchyEvidence: -type d -empty matches empty directories; -delete removes them
- find(1)Evidence: documents -empty and -delete ordering cautions
Last verified: 2026-09-18 · Category: Files & Folders
06Related solutions
find -mtime/-mmin locates files changed within a time window, and -exec acts on them in one pass.
tree prints an indented hierarchy of a directory, with depth limits, hidden files, and size options.
ncdu scans a directory tree, then lets you browse sizes, navigate, and delete space hogs with one keypress.