ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: walterkt on February 22, 2014, 02:13:46 PM

Title: Rename photo using modified date if DataTimeOriginal is missing
Post by: walterkt on February 22, 2014, 02:13:46 PM
Hi Phil,

Thanks for your program and I really love it. I got some questions when I try to rename my photo files.

For example, I have 2 files:
A.jpg with last modified date is 2014-02-23 12:52:51, but missing the "date taken"(DateTimeOriginal) in exif info
B.jpg with last modified date is 2014-02-22 10:50:51, "date taken"(DateTimeOriginal) is 2014-02-20 18:52:31

I want the result to be:
A.jpg to be "2014-02-23_12-52-51.jpg"
B.jpg to be "2014-02-20_18-52-31.jpg"

Is it possible to do it in 1 single command?

Actually I mean rename the file using exif date taken, if the value is not exists, use the file modified date instead.

Thanks!
Title: Re: Rename photo using modified date if DataTimeOriginal is missing
Post by: Phil Harvey on February 22, 2014, 04:50:51 PM
Sure, this is simple:

exiftool "-filename<filemodifydate" "-filename<datetimeoriginal" -d "%Y-%m-%d_%H-%M-%S.%%e" FILE

where FILE is one or more file and/or directory names.

The second FileName assignment overrides the first if DateTimeOriginal exists in the file.

- Phil

Edit: Forgot the file extension
Title: Re: Rename photo using modified date if DataTimeOriginal is missing
Post by: walterkt on February 25, 2014, 10:03:37 AM
Big Thanks Phil ! This program is amazing!

Finally I used the command:
exiftool.exe -d "%Y%m%d_%H%M%S%%-c.%%e" "-filename<filemodifydate" "-filename<datetimeoriginal" FILE/DIRECTORY

It is working perfectly.