Photo Organizer and Deduplicator
Synology DSM 7 Package #

Table of Contents #
- Overview
- Package Details
- GitHub Repository
- Download
- File Processing Logic
- Duplicate Handling
- Statistics Tracking
- Logging
- Synology Integration
- License
- Support
Overview #
Photo Organizer and Deduplicator is a Synology NAS package that automatically organizes and manages your photo collection. The application continuously monitors a designated folder and automatically sorts photos by their capture date, detects duplicates, and organizes your entire photo library with minimal user intervention.
Key Features #
- Automatic Folder Monitoring: Continuously watches a user-defined source directory and processes new files as they are added
- Intelligent Date Detection: Extracts date from EXIF metadata (with nested EXIF support), video metadata, or file timestamps
- Automatic Organization: Sorts photos into year/month-based folders (
YYYY/MM_Mmm/) with consistentyyyymmdd_hhmmss.extnaming - Duplicate Detection: Uses MD5 hash comparison to identify exact duplicates, with configurable handling (delete or move to Duplicates folder)
- File Renaming: Automatically renames files to consistent chronological format when date information is available
Package Details #
Package Information #
- Package Name: PhotoOrganizer
- Version: 1.0.1-0016
- Display Name: Photo Organizer and Deduplicator
- Architecture: noarch (works on all Synology NAS models)
- Minimum DSM Version: 7.0-40000
- Maintainer: MORCE.codes
- Type: Third-party package
Technical Requirements #
- Python: 3.7 or higher
- Dependencies:
Installation #
- Download the
.spkfile (see download link below) - Open Synology Package Center
- Click “Manual Install” and select the downloaded
.spkfile - Follow the installation wizard
- Configure the source and destination directories during setup
Usage #
Once installed, the service runs automatically in the background:
- Place photos in the configured source directory (default:
Photos/Photo Organizer) - The service automatically processes existing photos
- New photos added to the folder are automatically organized
- Photos are sorted into year-based folders with consistent naming
- Duplicates are detected and handled according to the configured settings
GitHub Repository #
The project source code, build scripts, and documentation are available on GitHub. Contributions, bug reports, and feature requests are welcome!
Download #
Latest Version: #
Download PhotoOrganizer-1.0.1-00019.spk
File Processing Logic #
The Photo Organizer uses a file system watcher to monitor the source directory and processes each file through the following workflow:
Processing Workflow #
File Detection: The system waits 0.5 seconds after detecting a new file to ensure it’s fully written (important for large files being copied)
File Type Detection: Determines if the file is an image or video based on file extension
Date Extraction (in priority order):
- Images:
- Attempts to read EXIF
DateTimeOriginalfrom top-level tags - If not found, searches nested EXIF data (ExifIFD) for
DateTimeOriginal - Falls back to
DateTimeDigitizedifDateTimeOriginalis unavailable - Uses sophisticated multi-level EXIF parsing to handle different camera formats
- Attempts to read EXIF
- Videos: Attempts to read creation date from video metadata (MP4/MOV using mutagen library)
- Fallback: Uses the older of file creation or modification timestamp (newer might have modifications)
- Images:
Destination Path Generation:
- If date found: Creates path
YYYY/MM_Mmm/(e.g.,2024/08_Aug/) - Filename format:
yyyymmdd_hhmmss.ext(without subseconds for destination folder) - If no date found: Moves to
NoDateFound/folder with original filename
- If date found: Creates path
Duplicate Check: Before moving, checks if a file with the same name already exists at the destination:
- Size Comparison: First compares file sizes (fast optimization)
- MD5 Hash Check: If sizes match, compares MD5 hashes
- Exact Duplicate: If hashes match, handles according to
DELETE_DUPLICATESsetting - Different Content: If hashes differ, compares modification times and keeps older file
File Movement: Moves the file to the appropriate destination folder:
- Files are renamed to consistent
yyyymmdd_hhmmss.extformat when date is available - Original filenames preserved for files without date information
- Duplicates are handled according to the configured strategy
- Files are renamed to consistent
Date Extraction Methods #
The application uses multiple methods to extract date information in priority order:
- EXIF Metadata (Images): Reads
DateTimeOriginalfrom top-level tags, then nested EXIF data (ExifIFD), with fallback toDateTimeDigitized. Supports both modern and legacy Pillow methods for maximum camera compatibility. - Video Metadata: Reads creation date from MP4/MOV metadata using mutagen library, supporting ISO 8601 format.
- File Timestamps: Uses the older of creation or modification time, preserving sub-second precision when available.
Duplicate Handling #
The application uses MD5 hash comparison for duplicate detection, with file size comparison first for performance optimization.
Handling Strategies #
Exact Duplicates (Same MD5 Hash):
- If
DELETE_DUPLICATES = true(default): Duplicate is deleted immediately - If
DELETE_DUPLICATES = false: Duplicate is moved toDuplicates/folder with subseconds/sequential naming
- If
Different Content (Same Filename, Different Hash):
- Keeps the older file in destination folder
- Moves newer file to
Duplicates/folder - Before moving to Duplicates, checks if an identical file already exists there (to prevent accumulation)
- If duplicate found in Duplicates folder, deletes current file instead of moving it
Filename Formats #
- Destination Folder:
yyyymmdd_hhmmss.ext(no subseconds) - Duplicates Folder:
yyyymmdd_hhmmss.ssss.ext(with subseconds when available) oryyyymmdd_hhmmss.0001.ext(sequential numbering)
Before moving a file to the Duplicates folder, the system checks if an identical file (same MD5 hash) already exists there. If found, the current file is deleted instead of creating another duplicate, ensuring efficient storage usage.
Statistics Tracking #
The application maintains statistics about file operations, tracking files/bytes moved to destination folders, moved to Duplicates, and deleted (duplicates). Statistics are stored persistently in Photo_Organizer_Statistics.json, automatically loaded on startup, and adjusted when files move between destination and Duplicates folders.
Statistics are automatically logged when:
- Service stops (final statistics before shutdown)
- Service is idle for 1 minute (logged before counter reset)
Logged format: Info, System, YYYY/MM/DD HH:MM:SS, PhotoOrganizer, Statistics (reason): X.XX GB moved, X.XX MB deleted
Logging #
The application uses multiple logging methods for reliability: system logger (accessible via DSM Log Center), Synology-specific logging, and package log files stored in the destination directory.
Log Files #
Photo_Organizer_Activities.log- Detailed file operation log- Tracks all file operations, moves, deletions, and duplicate handling
- Format:
Log, Time, IP address, User, Event, File/Folder, File size, File name, Additional Info
Photo_Organizer_Application.log- System and application events log- Records service start/stop, dependency checks, and system-level events
- Format:
Level, Log, Time, User, Event(Info, Warning, Error)
Photo_Organizer_Statistics.json- Persistent statistics file (see Statistics Tracking section)
Logged Events #
File Operations: File detected, file moved (with rename info), duplicate deleted, moved to duplicates (with reason), file moved/renamed, errors
System Events: Service started/stopped, dependency checks, statistics (see Statistics Tracking section)
Viewing Logs #
Via File Station or SSH: Log files located in destination directory (default:
/volume1/photo/)tail -n 50 /volume1/photo/Photo_Organizer_Activities.log tail -n 50 /volume1/photo/Photo_Organizer_Application.logVia DSM Log Center: Filter by tag
PhotoOrganizer(Control Panel → Log Center → System Logs)
Note: Log file names were changed in v1.0.1-00017 for clarity.
Log Format Details #
File Operation Log Format #
Each entry in Photo_Organizer_Activities.log contains (in order):
- Time: Timestamp in
YYYY-MM-DD HH:MM:SSformat - IP address: Local IP address of the NAS at the time of the operation
- User: System user running the service
- File name: Base filename (without folder path)
- File size: Human-readable file size (e.g., “2.45 MB”)
- Event: Operation performed (e.g., “File moved”, “Duplicate Deleted”, “Moved to Duplicates”, etc.)
- Additional Info: Contextual operation details (e.g., “Renamed to …”, “Moved from destination to duplicates - Different content”, etc.)
- File/Folder: Full file system path affected by the operation (final path after move or deletion)
Updated in v1.0.1-00017:
- Improved event descriptions for moved/deleted files, including statistics adjustments.
- Some operations may log both old and new destination paths when moving between destination and duplicates folders.
- Moved files from destination to duplicates folder will decrease destination stats and increase duplicates stats (see
Photo_Organizer_Statistics.json).
System/Application Log Format #
Each entry in Photo_Organizer_Application.log contains:
- Level: Log level (e.g., Info, Warning, Error)
- Log: Fixed value “System”
- Time: Timestamp in
YYYY/MM/DD HH:MM:SSformat - User: System user running the service
- Event: Description of system or application event (e.g., “Service Started”, “Service Stopped”, dependencies checked, statistics saved, errors, etc.)
Updated in v1.0.1-00017:
- Statistics dump on shutdown removed from application log to reduce clutter; see
Photo_Organizer_Statistics.jsonfor details.
- Application log now focuses on service events, startup/shutdown, and critical errors.
- Log file path and naming updated for clarity in this version.
Synology Integration #
The Photo Organizer is specifically designed to integrate seamlessly with Synology DiskStation Manager (DSM), providing native NAS functionality.
Synology Detection #
The application automatically detects if it’s running on a Synology NAS by checking:
- Presence of
/etc/synoinfo.conf - DSM version file at
/etc.defaults/VERSION - Standard Synology volume path
/volume1
Photo Indexer Integration #
The application automatically updates Synology’s photo indexer (synoindex) after file operations: removes deleted files from index (synoindex -D), updates index when files are moved (removes old path, adds new path), and silently handles cases where indexer is unavailable. This ensures Photo Station stays synchronized with file organization.
Configuration #
- Paths: Uses volume-based paths (default:
/volume1/photo/), configurable during installation and stored inconfig.ini - Config File Locations:
/var/packages/PhotoOrganizer/config.ini,/var/packages/PhotoOrganizer/var/config.ini, or/volume1/@appstore/PhotoOrganizer/var/config.ini(searched in order) - Service Management: Installs as
.spkpackage through Package Center, can be started/stopped via Package Center interface
License #
Copyright (c) 2025 MORCE.codes
This package provides automatic photo organization functionality for Synology NAS. The Photo Organizer and Deduplicator application is provided as-is for organizing photos based on EXIF metadata.
Support #
For issues, questions, or contributions, please visit the GitHub repository
Note: This package is designed specifically for Synology DiskStation Manager (DSM) and requires a Synology NAS running DSM 7.0 or later.