ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: lumiere on December 18, 2021, 03:26:43 PM

Title: sorting files: dateTimeOriginal vs CreateDate
Post by: lumiere on December 18, 2021, 03:26:43 PM
I am sorting all pictures I have just used exiftool with the following command:


exiftool "-filename<CreateDate" -d pictures/%Y/%m/%d/%Y-%m-%d_%H:%M:%S%%+c.%%e -r folder


It turned out some of those pictures have different Date and Time Digitized and Date and Time Original and were moved to not the folders I was hoping them to go.
I would assume CreateDate represents the original date/time of when the picture has been taken but refers to Date Time Digitized, am I right ?
Should I change my command to


exiftool "-filename<DateTimeOriginal" -d pictures/%Y/%m/%d/%Y-%m-%d_%H:%M:%S%%+c.%%e -r folder


?
Title: Re: sorting files: dateTimeOriginal vs CreateDate
Post by: StarGeek on December 18, 2021, 03:42:57 PM
DateTimeDigitized is CreateDate in exiftool.  This refers to when the image was digitized.  DateTimeOriginal is when the image was originally created.  For digital cameras, they would be the same, but if, for example, you where scanning film photos, DateTimeOriginal would be when the camera captured the image and CreateDate (DateTimeDigitized) would be when the image was scanned into the computer.

Whether you should change your command or not depends upon the data.  It's not something that can be definitively chosen without looking at the data.

But if you have one that you would prefer to use, you can use both in a command. Latter options will override earlier options, so you could use
exiftool "-filename<CreateDate" "-filename<DateTimeOriginal" -d pictures/%Y/%m/%d/%Y-%m-%d_%H:%M:%S%%+c.%%e -r /path/to/files/
and exiftool will prefer DateTimeOriginal and fall back to CreateDate if DateTimeOriginal does not exist.

If you wish to find all files where there is a difference between the two, you could use this to list all the files
exiftool -if "$DateTimeOriginal ne $CreateDate" -Filename /path/to/files/
Title: Re: sorting files: dateTimeOriginal vs CreateDate
Post by: lumiere on December 18, 2021, 04:28:15 PM
Thanks @StarGeek for your explanation - that really clarified the topic for me  :)

By the way - the last with the conditional command is fantastic - however it doesn't display file name(s):

$ exiftool -time:all -a -G0:1 -s 2002-12-08_12\:00\:00_32.jpg
[File:System]   FileModifyDate                  : 2014:05:04 20:04:34+01:00
[File:System]   FileAccessDate                  : 2021:12:18 20:21:30+00:00
[File:System]   FileInodeChangeDate             : 2021:12:14 08:07:32+00:00
[EXIF:ExifIFD]  DateTimeOriginal                : 2014:05:04 20:04:34
[EXIF:ExifIFD]  CreateDate                      : 2002:12:08 12:00:00
$ exiftool -if "$DateTimeOriginal ne $CreateDate" -Filename 2002-12-08_12\:00\:00_32.jpg
1 files failed condition

How do I display filenames when I scan a folder ?
Title: Re: sorting files: dateTimeOriginal vs CreateDate
Post by: StarGeek on December 18, 2021, 04:33:43 PM
It looks like you're not on Windows.  If so, you need to swap double/single quotes when there's a dollar sign involved.\
exiftool -if '$DateTimeOriginal ne $CreateDate' -Filename /path/to/files/
Title: Re: sorting files: dateTimeOriginal vs CreateDate
Post by: lumiere on December 18, 2021, 04:43:28 PM
Yes, that is right, this is not windows - it is linux :)
Now it works as expected. However is it possible to format the output ? Currently I get the following output which is difficult for further processing:

======== ./2002-12-08_12:00:00_217.jpg
File Name                       : 2002-12-08_12:00:00_217.jpg
======== ./2002-12-08_12:00:00_256.jpg
File Name                       : 2002-12-08_12:00:00_256.jpg
======== ./2002-12-08_12:00:00_183.jpg
File Name                       : 2002-12-08_12:00:00_183.jpg

I can involve scripting (grep/sed/awk) but maybe it is possible to do that natively just with exiftool ?
Title: Re: sorting files: dateTimeOriginal vs CreateDate
Post by: StarGeek on December 18, 2021, 06:00:21 PM
You can use the -p (-printFormat) option (https://exiftool.org/exiftool_pod.html#p-FMTFILE-or-STR--printFormat) to format the output in any way you want. Example (https://exiftool.org/exiftool_pod.html#exiftool--p-filename-has-date-dateTimeOriginal--q--f-dir)
Title: Re: sorting files: dateTimeOriginal vs CreateDate
Post by: lumiere on December 18, 2021, 06:34:25 PM
Thanks a lot StarGeek !