How to Sort Photos into Device/Year/Month/Day Folders with exiftool and Python

Old phone backups and SD card dumps end up as one giant folder of IMG_1234.HEIC files. This script reads the camera model and capture date from each file’s metadata and moves it into: Sorted Pictures/ └── iPhone 13/ └── 2023/ └── 07/ └── 14/ └── IMG_1234.HEIC What makes it safe Dry run by default. Nothing changes until you add --move. Moves, never copies. On the same drive that’s a true rename, so created and modified dates are preserved. Never overwrites. Name clashes get _1, _2 and so on. Re-runnable. The output folder is skipped when scanning. Step 1: Install the tools These steps are for macOS, but the script works anywhere Python 3 and exiftool are installed. ...