TidyBatch

How to rename photos by date taken

Turn IMG_4821.HEIC and DSC_0193.NEF into 2023-07-14_182205.heic, so photos from different cameras and phones sort into the order they were actually taken.

Use the "date taken", not the file date. Cameras and phones store the moment of capture inside the photo (EXIF DateTimeOriginal). The file's modified date changes when you copy, download or edit, so it's often wrong for old photos.

Option 1: ExifTool (free, every format)

ExifTool is the reference tool for photo metadata. Preview first with TestName, then apply with FileName. %-c adds -1, -2… when two photos share the same second (burst shots):

# Preview
exiftool -d '%Y-%m-%d_%H%M%S%%-c.%%e' '-TestName<DateTimeOriginal' .

# Apply
exiftool -d '%Y-%m-%d_%H%M%S%%-c.%%e' '-FileName<DateTimeOriginal' .

Sort into 2023/07/ folders instead (preview, then apply):

exiftool -d '%Y/%m/%%f.%%e' '-TestName<DateTimeOriginal' .
exiftool -d '%Y/%m' '-Directory<DateTimeOriginal' .

Videos keep their date in QuickTime metadata, usually stored in UTC. -api QuickTimeUTC converts it to your local time:

exiftool -api QuickTimeUTC -d '%Y-%m-%d_%H%M%S%%-c.%%e' '-TestName<CreateDate' -ext mov -ext mp4 .

Option 2: TidyBatch (free, with undo)

TidyBatch's {taken} field reads the EXIF date taken from JPEG, iPhone HEIC, TIFF, DNG and RAW files (tested on CR2, CR3, NEF, RW2 and RAF), with no extra libraries. It previews by default and keeps a journal, so you can undo the whole batch later:

# Preview
tidybatch rename ./camera -t "{taken:%Y-%m-%d_%H%M%S}{ext}"
#   Apple.jpg      ->  2016-09-28_181805.jpg
#   CanonRaw.cr3   ->  2018-02-21_120856.cr3
#   Nikon.nef      ->  2004-06-09_160235.nef

# Apply, and undo if you change your mind
tidybatch rename ./camera -t "{taken:%Y-%m-%d_%H%M%S}{ext}" --apply
tidybatch undo ./camera

Number a trip in the order the shots were taken, mixing phone and camera files:

tidybatch rename ./trip --sort taken -t "lisbon_{n:03}{ext}"

Two photos taken in the same second get _1, _2 instead of overwriting each other. Files without an EXIF date (most videos, screenshots, scans) use the modified date instead, so for videos use the ExifTool command above. Sorting into year/month folders by date taken (organize --by taken) is part of TidyBatch Pro; the free ExifTool -Directory command above does the same.

Which one should you use?

ExifToolTidyBatch
Photos (JPEG, HEIC, RAW)✓✓
Videos' recorded date✓falls back to modified date
Preview before renaming✓ TestName✓ default
Undo afterwards—✓ tidybatch undo
Other fields (counters, regex, clean names)via its own syntax✓ one template

Related: add the modified date to any file →

Related: rename files safely (Windows, macOS, Linux) →