How can I bulk rename photos using EXIF date/time while keeping the original filename?
Asked 7/15/2023
7 views
2 answers
0
I have photos from two sources with different naming schemes:
- Phone:
IMG_20180618_035708.jpg - Panasonic LX7:
P1910846.jpg
I want to batch rename the Panasonic files so they include the capture date/time from EXIF while keeping the original filename, for example:
20180618_035708 P1910846.jpg
Ideally this would be an automated bulk process rather than coding from scratch. I’d also like to know if I can remove the IMG_ prefix from phone filenames as part of the renaming process.
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
2y ago
2 Answers
2
Using exiftool, you would use this command to prefix the date time to the file name
exiftool -d "%Y%m%d_%H%M%S" "-Filename<$DateTimeOriginal %f.%e" /path/to/files/
The -d (-dateFormat) option is used to format the time stamp to your example. See ExifTool Common Date Format Codes for the list of date % variables.
DateTimeOriginal is the most common time stamp of when the photo was taken set by the camera.
The %f is the base filename of the original file and %e is the extension.
The command to remove IMG_ from the beginning of the filename would be
exiftool "-Filename<${Filename;s/^IMG_//}" /path/to/files/
These commands would be for running under Windows CMD. If run on Mac/Linux then you would change the double quotes into single quotes so the command line doesn't see the $ as the start of a shell variable.
Originally by user37960. Source · Licensed CC BY-SA 4.0
user37960
2y ago
0
Generated from our catalog & community — verify before relying on it.
Yes. A common tool for this is ExifTool, which can read the EXIF capture time (DateTimeOriginal) and rename files in bulk.
To prefix the date/time while keeping the original filename:
exiftool -d "%Y%m%d_%H%M%S" "-Filename<$DateTimeOriginal %f.%e" /path/to/files/
DateTimeOriginal= the photo’s capture time from EXIF%f= original filename without extension%e= extension-dformats the date asYYYYMMDD_HHMMSS
To remove IMG_ from filenames:
exiftool "-Filename<${Filename;s/^IMG_//}" /path/to/files/
On macOS/Linux, use single quotes instead of double quotes.
If you prefer a graphical app, Bulk Rename Utility can also use EXIF data and remove prefixes. If you need more control over exactly which metadata field is used, IMatch was suggested as a more powerful option.
Recommended products
UniqueBot
AI2y ago
Your Answer
Related Questions
How can I set photo 'Date Taken' EXIF metadata from the filename?
Can an edited photo still show when it was originally taken?
How can I batch-add EXIF timestamps that increase by a fixed interval?
Can you recover a photo’s original camera filename after the JPG has been renamed?
How can I set EXIF date tags from the filename using ExifTool?