Get the files without creationdate/DateCreated and add a predetermined timestamp

Started by tonic8, June 02, 2024, 05:27:44 PM

Previous topic - Next topic

tonic8

Hello

just discover that Exiftool had some possibilities without coding a script. So my question is:

using only exiftool parameters and command, is it possible to scan a folder, find ONLY the images without creationdate/DateCreated tag and set an arbitrary one? (and don't touch the other image with already tag in place)

the project: i have a folder with 2022 images, somes are perfectly tagged, but somes sent by friends are missing the date, i want to put 2022-01-01 00:01:00 on all the images without creationdate/DateCreated tag set.

or i have to run a first exiftool comamd to read and select the files and apply a second exiftool command to set the date?

Thanks a lot for your ideas
:)

StarGeek

You don't mention your OS, but the basic command using Windows CMD would be
exiftool -if "not $DateTimeOriginal" -DateTimeOriginal="2022-01-01 00:01:00" /path/to/files/

If you're on Mac/Linux, change the double quotes to single quotes.

But understand there are multiple tags which can be described as "creationdate/DateCreated". It depends upon what program you are using to check for this in the first place. It also might depend upon what type of file it is, because while JPEG files are well supported in most programs, PNG files do not have a lot of support in programs for reading metadata.

I would suggest double-checking a few files with this command first to see what data might already be there
exiftool -time:all -G1 -a -s /path/to/files/
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

tonic8

Hello StarGeek

my bad , it's under Windows, yes.

First thanks a lot for your quick response.

as sugggested i did some test with the command for read (1 image i know had no exif data and 1 that was pretty loaded.
C:\Temp\a>exiftool -time:all -G1 -a -s "C:\Temp\a\a"
======== C:/Temp/a/a/1094988.jpg
[System]        FileModifyDate                  : 2023:01:25 22:14:39+01:00
[System]        FileAccessDate                  : 2024:06:06 21:52:09+02:00
[System]        FileCreateDate                  : 2023:01:25 22:14:39+01:00
======== C:/Temp/a/a/IMG_3331.heic
[System]        FileModifyDate                  : 2022:03:24 18:38:40+01:00
[System]        FileAccessDate                  : 2024:06:06 21:51:12+02:00
[System]        FileCreateDate                  : 2024:06:02 14:20:19+02:00
[IFD0]          ModifyDate                      : 2022:03:12 21:25:06
[ExifIFD]       DateTimeOriginal                : 2022:03:12 21:25:06
[ExifIFD]       CreateDate                      : 2022:03:12 21:25:06
[ExifIFD]       OffsetTime                      : +01:00
[ExifIFD]       OffsetTimeOriginal              : +01:00
[ExifIFD]       OffsetTimeDigitized             : +01:00
[ExifIFD]       SubSecTimeOriginal              : 053
[ExifIFD]       SubSecTimeDigitized             : 053
[XMP-xmp]       CreateDate                      : 2022:03:12 21:25:06
[XMP-xmp]       ModifyDate                      : 2022:03:12 21:25:06
[XMP-photoshop] DateCreated                     : 2022:03:12 21:25:06
[ICC-header]    ProfileDateTime                 : 2017:07:07 13:22:32
[Composite]     SubSecCreateDate                : 2022:03:12 21:25:06.053+01:00
[Composite]     SubSecDateTimeOriginal          : 2022:03:12 21:25:06.053+01:00
[Composite]     SubSecModifyDate                : 2022:03:12 21:25:06+01:00
    1 directories scanned
    2 image files read

so then i did the other command
C:\Temp\a>exiftool -if "not $DateTimeOriginal" -DateTimeOriginal="2000-01-01 00:01:00" "C:\Temp\a\a"
    1 directories scanned
    1 files failed condition
    1 image files updated

that gave this result:
C:\Temp\a>exiftool -time:all -G1 -a -s "C:\Temp\a\a"
======== C:/Temp/a/a/1094988.jpg
[System]        FileModifyDate                  : 2024:06:06 21:53:59+02:00
[System]        FileAccessDate                  : 2024:06:06 21:54:00+02:00
[System]        FileCreateDate                  : 2023:01:25 22:14:39+01:00
[ExifIFD]       DateTimeOriginal                : 2000:01:01 00:01:00
======== C:/Temp/a/a/IMG_3331.heic
[System]        FileModifyDate                  : 2022:03:24 18:38:40+01:00
[System]        FileAccessDate                  : 2024:06:06 21:53:59+02:00
[System]        FileCreateDate                  : 2024:06:02 14:20:19+02:00
[IFD0]          ModifyDate                      : 2022:03:12 21:25:06
[ExifIFD]       DateTimeOriginal                : 2022:03:12 21:25:06
[ExifIFD]       CreateDate                      : 2022:03:12 21:25:06
[ExifIFD]       OffsetTime                      : +01:00
[ExifIFD]       OffsetTimeOriginal              : +01:00
[ExifIFD]       OffsetTimeDigitized             : +01:00
[ExifIFD]       SubSecTimeOriginal              : 053
[ExifIFD]       SubSecTimeDigitized             : 053
[XMP-xmp]       CreateDate                      : 2022:03:12 21:25:06
[XMP-xmp]       ModifyDate                      : 2022:03:12 21:25:06
[XMP-photoshop] DateCreated                     : 2022:03:12 21:25:06
[ICC-header]    ProfileDateTime                 : 2017:07:07 13:22:32
[Composite]     SubSecCreateDate                : 2022:03:12 21:25:06.053+01:00
[Composite]     SubSecDateTimeOriginal          : 2022:03:12 21:25:06.053+01:00
[Composite]     SubSecModifyDate                : 2022:03:12 21:25:06+01:00
    1 directories scanned
    2 image files read

that's perfect, i will work and check my folders and the apps that read the images to put in a timeline (to be sure what tag is used)

again thanks!
:)