Organising files
Undoing years of over-organisation is one command, plus one precaution.
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.
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.
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.
find . -type d -empty -delete
Deletes now-empty subfolders, deepest first. Run it last.
find . -mindepth 2 -type f -exec mv -n {} . \; — the -n refuses overwrites so name collisions survive.
find . -type d -empty -delete.
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