Everywhere All articles Download

Organising files

Collapsing a folder tree

Updated 2026-07-31 · 3 min read

Undoing years of over-organisation is one command, plus one precaution.

The Finder way (small jobs)

Search the parent folder for Kind is not Folder (⌘F, scope to the folder), select all results, drag to the destination. Finder search results are draggable, which makes it a flattener.

The Terminal way

Dry run first — see what would move and spot collisions:

cd ~/Messy
find . -mindepth 2 -type f | head -50
find . -mindepth 2 -type f | wc -l

-mindepth 2 selects only files inside subfolders. Then:

find . -mindepth 2 -type f -exec mv -n {} . \;

-n is the precaution: no overwrite. Two photo.jpgs in different subfolders would otherwise become one; with -n the second stays put, and a follow-up listing shows what remains:

find . -mindepth 2 -type f

Rename those stragglers (their parent folder name makes a good prefix) and re-run, or handle by hand if few.

Prefixing with the folder name instead

To keep provenance while flattening:

find . -mindepth 2 -type f | while IFS= read -r f; do
  parent=$(basename "$(dirname "$f")")
  mv -n "$f" "./${parent} - $(basename "$f")"
done

Holiday 2019/IMG_2041.jpg becomes Holiday 2019 - IMG_2041.jpg — flat, collision-proof, and each name now carries a searchable word.

Sweep the husks

find . -type d -empty -delete

Deletes now-empty subfolders, deepest first. Run it last.

Common questions

How do I move all files out of subfolders at once?

find . -mindepth 2 -type f -exec mv -n {} . \; — the -n refuses overwrites so name collisions survive.

How do I delete all the empty folders left behind?

find . -type d -empty -delete.

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.

Download for Mac

Related

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