Organize your memories chronologically — with precision and zero guesswork.
PhotoSort is a modern, Python-based photo and video organizer that automatically sorts your media by true creation date, using intelligent metadata detection and filesystem timestamps.
Perfect for casual photographers, content creators, and anyone drowning in thousands of unsorted photos from phones, cameras, or backup drives.
- 📱 Tired of scrolling endlessly through years of unsorted photos on your phone or computer?
- 🗂️ Want automatic organization without manually sorting thousands of files?
- 🔍 Can't find that vacation photo from 2019 because everything's in one giant folder?
- 📦 Merging photos from multiple devices, cloud backups, or old hard drives?
PhotoSort solves this. Point it at your messy photo library, and it automatically organizes everything into clean year/month folders based on when each photo was actually taken.
PhotoSort uses a weighted EXIF metadata model to extract the most reliable creation timestamp from each file. It intelligently prioritizes DateTimeOriginal over filesystem timestamps, handles timezone conversions, prevents duplicates, and works seamlessly across different operating systems and storage devices.
🧠 Metadata-based date detection — extracts and weights multiple EXIF fields
⚖️ Weighted reliability model — picks the most trustworthy creation date automatically
🗂️ Automatic folder hierarchy — organizes media into YEAR/MONTH/filename
🪶 Duplicate-safe renaming — never overwrites files
🔄 Cross-filesystem move — works seamlessly across disks and OSes
🧾 Progress bar + verbose logging
🧱 Dry-run mode — preview everything before moving files
🚫 Exclude folders — skip unwanted subdirectories
🪪 Preserves file timestamps & metadata
🧍♂️ Works on macOS, Linux, and Windows
🔰 New to photo organizing?
Don't worry about the technical terms above — PhotoSort handles all the complexity automatically. Just point it at your messy photo folder and let it work its magic!
- Python ≥ 3.8
- ExifTool (for reading photo metadata)
macOS:
brew install exiftoolUbuntu/Debian:
sudo apt-get install libimage-exiftool-perlWindows:
- Download ExifTool
- Extract the
.exefile - Add it to your system PATH
PhotoSort uses uv — a fast, modern Python package manager that creates isolated environments automatically. Think of it like a clean workspace just for PhotoSort.
macOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | shWindows (PowerShell):
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"git clone https://github.com/yourusername/PhotoSort.git
cd PhotoSortuv venvThis creates a .venv folder with a clean Python environment.
macOS/Linux:
source .venv/bin/activateWindows:
.venv\Scripts\activateYou'll see (.venv) appear in your terminal prompt — this means you're inside the PhotoSort environment.
uv pip install tqdm python-dateutilchmod +x photosort.pyuv run photosort.py \
--source "/Users/alex/CameraUploads" \
--destination "/Users/alex/OrganizedMedia"What happens:
- PhotoSort scans all photos/videos in the source folder
- Extracts creation dates from EXIF metadata
- Sorts files into folders like
2023/09/IMG_1234.JPG - Moves them to your destination directory
uv run photosort.py \
--source /mnt/photos \
--destination /mnt/organized \
--dry-run --verbosePerfect for first-time use! No files are moved — just a detailed simulation showing exactly what would happen.
uv run photosort.py \
--source /mnt/archive \
--destination /mnt/sorted \
--exclude "cache" "exports" "screenshots"Skips any folder whose path contains one of those names.
Before (messy):
CameraUploads/
├── IMG_0012.JPG (taken in 2018)
├── vacation_day1.jpg (taken in 2020)
├── wedding_01.HEIC (taken in 2019)
├── ChristmasParty.MOV (taken in 2018)
└── ... 5,000 more unsorted files
After (organized):
OrganizedMedia/
├── 2018/
│ ├── 01/
│ │ ├── IMG_0012.JPG
│ │ └── ChristmasParty.MOV
│ └── 12/
│ └── ...
├── 2019/
│ └── 05/
│ ├── wedding_01.HEIC
│ └── wedding_02.MP4
└── 2020/
└── 07/
└── vacation_day1.jpg
PhotoSort uses a weighted EXIF field model to choose the most reliable creation date:
| Metadata Field | Weight | Purpose |
|---|---|---|
| DateTimeOriginal | 1.0 | Primary creation date |
| CreateDate | 0.9 | Secondary EXIF timestamp |
| ModifyDate | 0.6 | Last modification date |
| FileCreateDate | 0.4 | Filesystem creation time |
| filesystem_mtime | 0.3 | Filesystem modification time |
If EXIF metadata is missing, it falls back to the filesystem timestamp — or current time as a last resort.
.jpg .jpeg .png .heic
.mp4 .mov .avi .mkv
You can extend support easily by editing EXTENSIONS in the script.
| Option | Description |
|---|---|
--source |
Source directory containing photos/videos |
--destination |
Target directory for organized files |
--dry-run |
Simulate without moving files |
--verbose |
Print detailed logs |
--exclude |
List of subfolders to skip |
MIT License — free to use, modify, and distribute.
See LICENSE for full text.
Pull requests, issues, and ideas are welcome!
If you add new metadata fields, file types, or features (e.g. duplicate detection, cloud sync), open a PR and help improve PhotoSort for everyone.
photo organizer, video organizer, metadata-based sorting, python exiftool, photo library manager, digital asset organizer, photo sorter, uv python, astral uv, date-based media organizer, open source photo tool, exif date sorter, camera roll organizer
If PhotoSort saved you hours of manual sorting, consider:
- ⭐ Starring the repo on GitHub
- 🐛 Reporting bugs or suggesting features
- 📢 Sharing with fellow photographers
Made with ❤️ for photographers who value their memories.