Any syntax for variable length 'noise' string in filename to parse?

Started by feet, February 10, 2022, 04:27:25 PM

Previous topic - Next topic

feet

Have looked through and not found a similar question / answer.

Trying to do similarly to this post (write exif date/time from filename) but I have a string at the beginning of each file that is variable in content (e.g. a counter) and in length (e.g. sometimes the file has a "tl_" prefix and sometimes something else three characters long).

Is there any syntax to ignore x number of characters as 'noise' and then continue relevant parsing command syntax?

Thanks

StarGeek

Can you give some exact examples?  It might be easier just to match the date/time pattern.  For example, if you had something like
tl_some1234JunkNumbers893-2016-10-06_17-59-46-morejunk.jpg
then you could use
exiftool "-DateTimeOriginal<${Filename;m/(\d{4}-\d\d-\d\d_\d\d-\d\d-\d\d)/;$_=$1}" tl_some1234JunkNumbers893-2016-10-06_17-59-46-morejunk.jpg
and that will match 4DigitsDash2DigitsDash2DigitsUnderscore etc, etc and remove everything else.  The result would work as the significant 14 digits will remain and the separating characters are ignored (see FAQ #5, paragraph starting "Having said this").
"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

chuck lee

Is your file name date/time format consistent?  Post some sample file names, exiftool can process YYYYmmddHHMMSS easily, only if the format follows some pattern.  :)