Skip to content

Photo_renamer is a cross-platform shell script for organizing messy photo/video archives into a clean, chronological folder structure based on metadata (EXIF and fallback timestamps).

keefeere/photo_renamer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

# photo_renamer.sh

photo_renamer.sh is a cross-platform shell script for organizing messy photo/video archives into a clean, chronological folder structure based on metadata (EXIF and fallback timestamps). Designed to handle multi-device backups with duplicates, inconsistent naming, and unsorted content.

✨ Features

  • ✅ EXIF-based date extraction (DateTimeOriginal, CreateDate, etc.)
  • ✅ Fallback to file creation/modification time
  • ✅ Smart renaming to format: YYYYMMDD-HHMMSS.ext
  • ✅ Optional prefix (IMG_, VID_) toggle
  • ✅ Duplicate-safe: adds suffixes only when needed
  • ✅ Handles name collisions by appending suffixes only when needed (e.g., IMG_20230701-143000_001.jpg)
  • ✅ Idempotent: supports repeated runs with _Renamed exclusion
  • ✅ MPO & RAW support (e.g. .cr2, .mpo)
  • ✅ CLI preview before execution
  • ✅ Synology-compatible & lightweight (no DB or indexing)

📦 Output structure

/_Renamed/
└── 2023/
└── 07/
├── IMG_20230701-143000.jpg
├── VID_20230701-150000.mp4
└── …

🔧 Usage

sh photo_renamer.sh
  • Requires exiftool
  • Tested on macOS, Linux, Synology DSM (with exiftool installed)
  • Interactive confirmation before renaming
  • Excludes already renamed folders (_Renamed, @eaDir, @Recycle, etc.)

⚙️ Configuration

Edit constants at the top of the script:

ADD_PREFIX=0       # 1 to enable IMG_/VID_ prefix, 0 to disable
TARGET_ROOT="./_Renamed"

📌 Why this script?

This tool was born out of frustration with 15+ years of backups from multiples phones, cloud dumps, messily named folders and files like IMG_20210809_100101.jpg or [17.04.2008] - 010.mp4. It aims to:

  • unify naming
  • eliminate duplicates
  • allow easy merge of backups
  • support future deduplication and cloud import
  • handles file name collisions gracefully by preserving content and avoiding overwrites

About

Photo_renamer is a cross-platform shell script for organizing messy photo/video archives into a clean, chronological folder structure based on metadata (EXIF and fallback timestamps).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages