Find empty files and directories with find

Use the find command with the -empty primary to locate zero-byte files and folders that contain nothing, a forgotten corner of the tool most people never use.

macOScleanupempty-filesfindLow risk
Run `find . -type f -empty` to list empty files and `find . -type d -empty` to list empty directories under the current folder.

01Command

Command
$ find . -type f -empty
find . -type d -empty

02What it does

The -empty test matches files of size zero and directories with no entries. Combining it with -type f or -type d narrows the result to one kind, and -delete can be chained to remove empty directories in one pass, though printing the list first is safer.

03Risk

RiskLow risk
!Warning: Deleting empty directories with `find . -type d -empty -delete` removes them recursively bottom-up; make sure you started find in the right folder, since this cannot be undone.

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

Last verified: 2026-09-17 · Category: Files & Folders

06Related solutions