A photo hierarchical sorting Linux CLI Python-based tool that organizes photos based on EXIF metadata using multi-level hierarchical sorting.
- Recursive photo discovery: Searches folders and subfolders for JPEG/TIFF images
- EXIF data extraction: Extracts date/time, artist, camera/lens model, and image dimensions
- Hierarchical sorting: Organizes photos using strict multi-level hierarchy based on EXIF properties
- Four-level hierarchy: Camera model → Artist → Date (day granularity) → Picture size (L/M/S)
- Size classification: Automatically classifies photos as Large (12MP+), Medium (3MP+), or Small (<3MP)
- Unknown value handling: Gracefully handles missing EXIF data with "unknown" placeholders
- Organized folder structure: Creates descriptive folder names based on hierarchical sorting
- Symlink organization: Creates symlinks to original photos (preserving original file structure)
- Relative paths: Uses relative symlinks for portability
pip install -e .- Python 3.7+
- Pillow (for image processing)
- click (for CLI interface)
exifsort SOURCE_FOLDER OUTPUT_FOLDER [OPTIONS]SOURCE_FOLDER: Path to folder containing photos to sortOUTPUT_FOLDER: Path where hierarchical folder structure will be created
-v, --verbose: Enable verbose logging--dry-run: Show what would be done without creating files--help: Show help message
# Basic usage - hierarchical sorting by camera model > artist > date > size
exifsort /path/to/photos /path/to/output
# Dry run to see what would happen
exifsort /path/to/photos /path/to/output --dry-run --verbose
# Verbose output to see detailed sorting process
exifsort /path/to/photos /path/to/output --verbose- Discovery: Recursively scans the source folder for supported image files (.jpg, .jpeg, .tiff, .tif)
- EXIF Extraction: Extracts relevant EXIF properties:
- Date and time (DateTime, DateTimeOriginal, DateTimeDigitized)
- Artist information
- Camera/lens model (Model, LensModel, Make)
- Image dimensions (width, height) for size classification
- Hierarchical Sorting: Organizes photos using strict 4-level hierarchy:
- Level 1: Camera model (including "unknown" for missing data)
- Level 2: Artist (including "unknown" for missing data)
- Level 3: Calendar date (day granularity: YYYY_MM_DD)
- Level 4: Picture size (L: 12MP+, M: 3MP+, S: <3MP)
- Organization: Creates folders with hierarchical names and creates symlinks to original photos
The tool creates folders with hierarchical names following this pattern:
camera_{MODEL}_artist_{ARTIST}_date_{YYYY_MM_DD}_size_{L|M|S}
Examples:
camera_Canon_EOS_R5_artist_John_Doe_date_2023_08_15_size_Lcamera_Nikon_D850_artist_Jane_Smith_date_2023_08_16_size_Mcamera_Sony_A7_III_artist_Bob_Johnson_date_2022_12_25_size_Scamera_unknown_artist_unknown_date_2024_01_01_size_S(for missing EXIF data)
Size Classification:
- L (Large): 12MP+ (12,000,000+ pixels)
- M (Medium): 3MP+ (3,000,000+ pixels)
- S (Small): Less than 3MP
Each folder contains symlinks to the original photo files, preserving the original file structure while creating an organized hierarchical view.
- JPEG (.jpg, .jpeg)
- TIFF (.tiff, .tif)
This project is open source and available under the MIT License.