Non standard filename used to update exif alldates

Started by aperturemode, August 17, 2023, 12:21:59 AM

Previous topic - Next topic

aperturemode

This is a variation of FAQ 5 where the filename is used to update alldates:

exiftool "-alldates<filename" c:\images

However, my filename doesn't follow the requird formatting but looks as follows:

00003197-PHOTO-2018-05-16-18-36-11.jpg

where the data is in blue and time is orange. The problem is the 8 digit file identifier at the beginning of the filename. How can I manually update the exiftool command to allow for this?

Also, if this requires perl regex in the command, do you have a webpage reference that could be used to make further adjustments for other file formats?

Thank you.

StarGeek

Try
exiftool "-alldates<${filename;s/^\d+//}" c:\images

This will strip away all the digits from the beginning of the file name before writing the date.

Quote from: aperturemode on August 17, 2023, 12:21:59 AMAlso, if this requires perl regex in the command, do you have a webpage reference that could be used to make further adjustments for other file formats?

There are a lot of tutorials out on the web.  The one I originally learned from is Regular-Expressions.info which has info for Perl regex as well as other languages.

You can use a site like RegEx101 to test out your regular expressions.  It gives a break down of the regex in the upper right.

Most of my learning, though, came from doing a search on "Perl Regex" and what I wanted to accomplish.  The various StackExchange sites often come up at the top of the search. You can then copy paste what you find into Regex101 to learn more about what is actually happening.

That's also pretty much how I learned what I know of Perl.  Search what I wanted to do with "Perl" as part of the search and checked for what I could find on the StackExchange sites.
"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

aperturemode

Thank you very much StarGeek!

Regex is tricky but your references will help a lot. It's really fantastic to get that power and flexibility with ExifTool.