News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Invalid Date string 22-06-12 19-05-27 0441.jpg

Started by Jitters2942, June 13, 2022, 11:09:13 AM

Previous topic - Next topic

Jitters2942

Hello Exiftool Guru's

The subject is just an example for my naming scheme in which i want to use exiftool for editing metadata..
My problem is, that I have a few percent of my photos stored without valid dates in my metadata. Don't ask me how i did achieve that...

My idea to save the day was pretty easy, just ask the almighty exiftool to read the date from the filename but i had limited success doing that.
exiftool wants a 4 digit number for year, otherwise it is refusing to comply.

My folder structure looks like this:

Pictures
- 2022
    - 06
      - 22-06-12 19-05-27 0441.jpg
      - IMG_1234.jpg
      - _MG_5678.CR2
- 2021

.. and so on. you get the idea..

I would just like to run exiftool selective on ALL pictures which are missing a valid "CreateDate" and TRY to read it from the filename.

My other option is to FIRST script something on the shell which does select all this photos for me and renames them with adding al leading "20" to each and every file affected..
Problem with that is, that I will get other problems due to the stupid naming scheme using spaces in the filename, would have to identify a 100% fool-proof way to not nuke my library or my whole server because of that and/or other problems.

You guys got some handy-hack for me to get around scripting this? Could I maybe force the 20 down exiftools throat while inspecting the files?

exiftool -if '$createdate eq "0000:00:00 00:00:00"' "-Testname=20%f.%e" /some/path/2022/06/ or something similar to this should be possible?


Best regards

Christoph


StarGeek

When you say "valid CreateDate", what exactly do you mean?  Do you mean files that are missing the CreateDate completely?  Or are they malformed, such as using dashes instead of colons, i.e. having a value 2022-06-13 12:00:00 instead of 2022:06:13 12:00:00 (some software incorrectly writes dates like this).  Or are they incomplete?  For example, missing the time and only have a value of 2022-06-13?

The basic copy operation would be to just add the 20 before the filename
exiftool "-CreateDate<20$Filename" /path/to/files/

The -if option to limit processing would be dependent upon what your invalid CreateDate values are.
* 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).

Jitters2942

Hi StarGeek,

with invalid create date, i meant basically 99% all zeroes, so: "0000:00:00 00:00:00" and a few with the year 1904

I approached the command in the wrong way by doing stuff like "-Testname=20%f.%e" and other stuff..  I was unable to figure out the obvious you stated and just use: '-CreateDate<20$Filename' (hint: with "" double quotes this does not work, I had to use '' single quotes,)

Thank you very, very much for your kind help!