Rename photo using modified date if DataTimeOriginal is missing

Started by walterkt, February 22, 2014, 02:13:46 PM

Previous topic - Next topic

walterkt

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!

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

walterkt

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.