Set CREATE DATE to a new value

Started by ULSWK, August 11, 2021, 07:57:24 AM

Previous topic - Next topic

ULSWK

Hi all,
I found a lot of posts regarding date manipulation, but non, which would help solving my problem. I hope I haven't overseen any.

My problem:
I have a a larger number of scanned jpeg files. All these files are named like YYYYMMDD_SC_#### where YYYYMMDD is the Information when the photo has been taken.
Of cause, the scanner writes the date of the scan to originaldate und not the real one.

It's easy for me to write a sub in Visual Basic, that can scan the folders and extract all filenames witch have to be processed for a datechange.
I can call a batch with an exiftool command to change the date with the exiftool, but unfortunately I allways get an error.

exiftool -createdate=1980:12:01 D:\SCANS\TEST.JPG lead to: Warning: Invalid date/time

Can someboady help with the correct syntax?

Thank's
Ulrich


StarGeek

See FAQ #5

If you read the entire error, it tells you what the problem is (emphisis mine)
Warning: Invalid date/time (use YYYY:mm:dd HH:MM:SS[.ss][+/-HH:MM|Z])

Timestamps in most cases require Hours:Minutes:Seconds in addition to Year:Month:Date.

Also, there is no need to write a VB script and it would actually slow you down to do so (see Common Mistake #3).  Exiftool has extremely powerful batch abilities and can do this on it's own without scripting.

Exiftool has the ability to write the date directly based upon the file name (see the aforementioned FAQ #5) .  The only problem in this case is to remove the scanner number and add default Hour:Minute:Second, for which most people use 00:00:00 (Midnight on that day).  Since the first 8 characters in your filename pattern contain the needed information, you would capture that and strip away the rest.  Additionally, I'd suggest using the AllDates shortcut as that will write the three most commonly used EXIF timestamps

Try this command
exiftool "-AllDates<${Filename;s/^(\d{8}).*/$1/} 00:00:00" D:\SCANS

This command creates backup files.  Add -Overwrite_Original to suppress the creation of backup files.  Add -r to recurse into subdirectories.
* 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).

ULSWK

Hello StarGeek,
thank's for your advice!

Unfortunately it doesn't work.
I set up a new directory (D:\SCANS\) with one jpeg file only for test purposes.
The jpg file is an ordinary file, nothing special, not write protected, ....

This is the result:
Warning: No writable tags set from D:/SCANS/TEST.jpg
    1 directories scanned
    0 image files updated
    1 image files unchanged

Any idea what could have gone wrong?

Greetings
Ulrich

ULSWK

Argggg!,
sorry, I'm a fool.
Your script is fine, I changed my filename structure for the test.
Something so stupid!

It works well.

Thank you!!