A collection of shell scripts for analyzing and managing EXIF timestamp data in JPEG images, particularly useful for fixing photo organization issues in Apple Photos and other photo management applications.
exiftoolmust be installed:brew install exiftool- Bash shell
Extracts and analyzes all timestamp-related EXIF data from JPEG files in a directory.
Usage:
./extract_exif_timestamps.sh <directory_path>Features:
- Extracts all timestamp fields (DateTimeOriginal, DateTime, DateTimeDigitized, CreateDate, FileModifyDate, GPSDateTime, ContentCreateDate, MediaCreateDate, TrackCreateDate)
- Creates a CSV file with all timestamp data
- Analyzes ContentCreateDate formats
- Performs timezone analysis with offset calculations
- Compares filename order against timestamp field orders
- Generates detailed reports for troubleshooting photo sorting issues
Output:
- Console table showing all timestamp fields
- CSV file:
<directory>/exif_timestamps.csv - Detailed analysis sections for timezone and ordering
Sets the OffsetTimeOriginal EXIF field for a single JPEG file.
Usage:
./set_offset_time.sh <file_path> <offset_time>Examples:
./set_offset_time.sh /path/to/photo.jpg "+01:00"
./set_offset_time.sh /path/to/photo.jpg "-05:00"Features:
- Validates offset format (+HH:MM or -HH:MM)
- Preserves original file (uses -overwrite_original flag)
- Verifies the change was applied successfully
Sets the OffsetTimeOriginal EXIF field for all JPEG files in a directory.
Usage:
./set_offset_time_bulk.sh <directory_path> <offset_time>Examples:
./set_offset_time_bulk.sh /path/to/photos "+01:00"
./set_offset_time_bulk.sh /path/to/photos "-05:00"Features:
- Processes all JPEG files in the specified directory
- Shows progress for each file
- Counts successful and failed operations
- Non-recursive (only processes files in the specified directory)
Displays the current OffsetTimeOriginal values for all JPEG files in a directory.
Usage:
./check_offset_times.sh <directory_path>Features:
- Lists all JPEG files with their OffsetTimeOriginal values
- Formatted table output
- Shows "N/A" for files without offset time data
-
Analyze existing timestamps:
./extract_exif_timestamps.sh /path/to/photos
-
Check current offset times:
./check_offset_times.sh /path/to/photos
-
Set timezone offset for all photos:
./set_offset_time_bulk.sh /path/to/photos "+01:00" -
Verify changes:
./check_offset_times.sh /path/to/photos
- Fix photo chronological ordering in Apple Photos when timezone information is missing
- Analyze EXIF data to understand why photos are not sorting correctly
- Bulk update timezone offset information for photos taken in different time zones
- Debug timestamp inconsistencies between different photo management applications
- Supports JPEG files (.jpg and .jpeg extensions, case-insensitive)
- Only processes files in the specified directory (not subdirectories)
- Preserves original files by default