Everywhere All articles Download Buy for $19

Finding specific things

Hunting down empty folders on your Mac

Updated 2026-10-30 · 4 min read

Terminal can list every empty folder in a tree with one command that deletes nothing. Here is that command, the hidden file that makes some folders slip through, and how to remove the rest safely.

List them with find

Terminal can list empty folders in one line. This only prints; it deletes nothing:

find ~/Documents -type d -empty

Swap ~/Documents for the folder you want to check, or type find , drag a folder from Finder onto the window, then add -type d -empty. Every line printed is a folder with nothing in it, at any depth.

One catch: Finder quietly adds a hidden .DS_Store file to folders it has displayed. To find, a folder holding only that file is not empty, so the command above misses it. The next section lists those too.

Folders that only look empty

A folder you opened in Finder often contains a hidden .DS_Store and nothing else. In Finder it looks empty; for find -empty it isn't. This command lists every folder in the tree whose only content is .DS_Store (or nothing at all):

find ~/Documents -type d -exec sh -c 'for d; do [ "$(ls -A "$d" | grep -vx .DS_Store | wc -l)" -eq 0 ] && echo "$d"; done' sh {} +

It is read-only. On a test tree it listed a folder holding only .DS_Store, and a truly empty nested folder, and skipped a folder that also had a real file. The folder you name at the start is itself included if it is empty, so read the first line of output.

Using Spotlight instead

Spotlight stores a count of the items in each folder, so it can answer "which folders have zero items" without walking the disk:

mdfind -onlyin ~/Documents 'kMDItemFSNodeCount == 0 && kMDItemContentType == "public.folder"'

Every folder it lists had nothing inside when checked with ls -A. Two limits apply. It only sees what Spotlight has indexed, so it misses unindexed drives and gives partial answers while the index is rebuilding. And a hidden .DS_Store counts as an item: a folder holding only that file reports a count of 1, so this query skips the same folders find -empty does. Treat find as the reference.

Deleting them, safely

Work through these in order.

1. Read the list

Run the listing command and scroll through it. An empty folder is not always junk: a project may expect an output folder to exist, and a folder shared with other people may be a placeholder.

2. Skip bundles and project internals

Apps, packages and Git repositories ship with empty folders they need. Leave them out of the search:

find ~/Documents -type d -empty -not -path '*.app/*' -not -path '*/.git/*'

3. For a few folders, use the Trash

In Finder, choose Go > Go to Folder… (⇧⌘G), open the folder from the list, select the empty folder and press ⌘⌫. That sends it to the Trash, where you can still get it back.

4. For a long list, delete only inside a folder you chose

The man page for find says -delete works depth first and will not delete a directory that isn't empty, so a chain of nested empty folders goes in one pass, deepest first. It also warns that -delete acts at once and should come last in the command. -mindepth 1 keeps the folder you started in, even if it turns out to be empty, and the two -not -path tests keep app bundles and Git internals out of it:

find ~/Documents/Old\ Projects -mindepth 1 -type d -empty -not -path '*.app/*' -not -path '*/.git/*' -delete

Run the same command with -print in place of -delete first, as the man page itself suggests, and read what it prints. Deleting this way does not use the Trash, so it can't be undone from there. Folders whose only content is a .DS_Store are not empty to find, so they stay; remove those by hand once you've looked inside.

Never point it at /, /Applications, /Library or ~/Library. Those hold system and app folders, and some apps and macOS expect empty ones to be there.

What Finder and Everywhere can do

Finder's search won't do this job on its own: its Kind menu has Folder, but no choice for an empty one, so the Spotlight attribute above is the nearest thing. Everywhere has no empty-folder filter either, and it can't tell you whether a folder is empty. It helps once you know the name: type folder:Archive to list only folders whose names match, each shown with the folder it's in, then press ⌘↵ to reveal one in Finder and look inside. For other find tests by name, size and date, see how to find files from Terminal; if the empty folders were left behind by moving files up a level, flattening a folder structure covers that job.

Common questions

How do I find empty folders on a Mac?

Run find ~/Documents -type d -empty in Terminal, changing the path to the folder you want to check. It lists empty folders at every depth and deletes nothing.

How do I delete empty folders on a Mac?

Review the list from find, then move a few to the Trash in Finder, or run find <folder> -mindepth 1 -type d -empty -delete on a folder you chose. Run it with -print in place of -delete first, because -delete skips the Trash.

Why does find say a folder isn't empty when Finder shows nothing?

The folder probably contains a hidden .DS_Store file, which Finder creates to remember how the folder is displayed. The second command in this post lists folders where that is the only content.

Is it safe to delete empty folders?

Usually, in your own documents, but not inside apps, ~/Library or Git projects, which may need their empty folders. Read the list first and keep the search away from system locations.

Find any file before you finish typing

Everywhere keeps track of every file on your Mac, including the folders Spotlight hides and drives you have unplugged. Free for a day, then $19 once.

Version 2.20.3 · macOS 13+ · 4.7 MB · notarised

Related

© 2026 Caretopia Network Private Limited Everywhere for Mac Buy a licence Articles Privacy Support