Find and display files - CreateDate not match DateTimeOriginal?

Started by unstaybull, June 06, 2025, 11:38:40 PM

Previous topic - Next topic

unstaybull

On Linux, I attempted to run an exiftool command to find all files in a directory where the 'createdate' does not match the 'datetimeoriginal'.

It doesn't work. Can someone assist? I appreciate your time. Thanks.

Here is what I came up with: the directory contains .jpg, .jpeg, and .mov files:
Command:
exiftool -p /mnt/81ba3dc5-9a57-4639-91e0-69072a11467d/Album/People/2012/ -ext jpeg,jpg,mov -q -q -r -if "$createdate!=$datetimeoriginal"

greybeard

Try this to list the directory, filename and the dates:

exiftool -ext jpeg -ext jpg -ext mov -r -Directory -FileName -CreateDate -DateTimeOriginal -if '$createdate ne $datetimeoriginal'
/mnt/81ba3dc5-9a57-4639-91e0-69072a11467d/Album/People/2012


unstaybull

#2
Hi greybeard,

I put that into the 2021 folder... it scanned, but it didn't list which file (or dir) doesn't have a createdate matching the datetimeoriginal? I re-read my initial post and didn't really specify well on my intent... I am trying to have this command scan, find which file/s is/are not matching the createdate and datetimeoriginal, and then list which file/s are not matching?

Sorry if I did not do a good job in my initial post. The command gave me this response:

    1 directories scanned
    1 files failed condition
    0 image files read

Thank you

greybeard

You would get that result if there was one file in the 2012 sub-directory and the dates matched.

What happens if you change directory to the 2012 sub-directory - make sure there are some jpg, jpeg or mov files in that directory and type:

exiftool -ext jpeg -ext jpg -ext mov -r -Directory -FileName -CreateDate -DateTimeOriginal -if '$createdate ne $datetimeoriginal' .

StarGeek

Quote from: unstaybull on June 06, 2025, 11:38:40 PMHere is what I came up with: the directory contains .jpg, .jpeg, and .mov files:
Command:
exiftool -p /mnt/81ba3dc5-9a57-4639-91e0-69072a11467d/Album/People/2012/ -ext jpeg,jpg,mov -q -q -r -if "$createdate!=$datetimeoriginal"

Thank you for including your OS and the command you used. That helps with our responses.

The reason this fails is that you are using a numeric comparison != and date/time tags are strings. In Perl (which is what exiftool is written in), forcing a string to be treated as numeric means that only the first number encountered will be used. Then will end up only comparing the year and not the rest of the date/time numbers.

As Greybeard shows, the string comparison would be ne (see Perl operators).

Quote from: unstaybull on June 07, 2025, 09:33:38 AMSorry if I did not do a good job in my initial post. The command gave me this response:

    1 directories scanned
    1 files failed condition
    0 image files read

This output shows that there was only one file in the directory and the CreateDate and DateTimeOriginal were matching (assuming you used Greybeard's command). Are there supposed to be more files?

Here's an example (with swapped quotes because I'm on Windows). In file 1, the tags match, in file 2, they are off by a day and an hour.
C:\>exiftool -G -a -s -CreateDate -DateTimeOriginal Y:\!temp\x\y\z
======== Y:/!temp/x/y/z/1.jpg
[EXIF]          CreateDate                      : 2025:06:07 07:40:00
[EXIF]          DateTimeOriginal                : 2025:06:07 07:40:00
======== Y:/!temp/x/y/z/2.jpg
[EXIF]          CreateDate                      : 2025:06:06 06:40:00
[EXIF]          DateTimeOriginal                : 2025:06:07 07:40:00
    1 directories scanned
    2 image files read

C:\>exiftool -G -a -s -ext jpeg -ext jpg -ext mov -r -Directory -FileName -CreateDate -DateTimeOriginal -if "$createdate ne $datetimeoriginal" Y:\!temp\x\y\z
======== Y:/!temp/x/y/z/2.jpg
[File]          Directory                       : Y:/!temp/x/y/z
[File]          FileName                        : 2.jpg
[EXIF]          CreateDate                      : 2025:06:06 06:40:00
[EXIF]          DateTimeOriginal                : 2025:06:07 07:40:00
    1 directories scanned
    1 files failed condition
    1 image files read

"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

unstaybull

Got it - thank you, StarGeek. It read the correct number of files. I did not have a .mov file in the 2012... I thought I did.

Greybeard - thank you for the help.

These work great. I appreciate everyone's time.

StarGeek

You should take note that MOV files will rarely have a DateTimeOriginal tag. It's pretty uncommon.

This command will also fail (i.e. not display any files) if either CreateDate or DateTimeOriginal doesn't exist.

If you want to find MOV files that don't have a DateTimeOriginal as well, then that will need a different command.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

unstaybull

Is there a way to run the command without typing out the full directory path? Like

exiftool -G -a -s -CreateDate -DateTimeOriginal Y:\!temp\x\y\z

(but instead of the path...at the end), TRY:

exiftool -G -a -s -CreateDate -DateTimeOriginal curdiror something?

Sorry if that's not detailed.  I have a lot of directories. I'm still on Linux. I just copied the example from StarGeek's  post above.

unstaybull

Quote from: StarGeek on June 07, 2025, 02:26:18 PMYou should take note that MOV files will rarely have a DateTimeOriginal tag. It's pretty uncommon.

This command will also fail (i.e. not display any files) if either CreateDate or DateTimeOriginal doesn't exist.

If you want to find MOV files that don't have a DateTimeOriginal as well, then that will need a different command.

Just read this... sorry. I have a lot of MOV files... Is the command a matter of replacing DateTimeOriginal with whatever the MOV file property is for its original date? Can you assist with this other command for MOV files. Just want to make sure MOV files have both their create date and original date.

Phil Harvey

In general, MOV files won't have a DateTimeOriginal.  They typically only have CreateDate and ModifyDate.

In the command, you can use "." to represent the current working directory.  You can also add -r to recursively process files in subdirectories.

- Phil
...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 ($).

StarGeek

Quote from: unstaybull on June 27, 2025, 09:22:14 PMexiftool -G -a -s -CreateDate -DateTimeOriginal curdiror something?

The to process the current directory, you would use a single dot, as in Greybeard's post above. Two dots is the parent directory

Quote from: unstaybull on June 27, 2025, 09:31:38 PMJust read this... sorry. I have a lot of MOV files... Is the command a matter of replacing DateTimeOriginal with whatever the MOV file property is for its original date? Can you assist with this other command for MOV files. Just want to make sure MOV files have both their create date and original date.

The CreateDate is supposed to be the original date. There's a slight technical difference between DateTimeOriginal and CreateDate, but that only applies to images that are from a film source and later scanned/digitized.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype