Given jpg files with the following example file names in <dir> - (Note that I use dot or period for <dir> after CD to the particular directory:
1968-06-05 ~xxxxxxxxxxxxxxxx ~001.jpg
2002-06-05 ~xxxxxxxxxxxxxxxx ~002.jpg
2003-05-05 ~xxxxxxxxxxx844xx ~003.jpg
2004-06-06 ~xxxxxxxxxxxxxxxx ~079.jpg
Using the following command individually works as expected on the first two files:
exiftool -'FileCreateDate<$filename 111111' -'AllDates<$filename 111111' -execute -if '$Filename lt "1972"' -FileCreateDate=19720101000000 -AllDates=19720101000000 -common_args -overwrite_original_in_place -P <dir>
However, the other two files do not get changed. I have determined that the error is caused by additional numbers and/or numerals higher than six within the file name.
How can I tell Exiftool to only consider the date at the beginning of the filename?
You could use something like this
'-AllDates<${filename;m/^([\d-]*)/$_=$1} 111111'
This will match any digits or hyphens at the start of the file name and drop anything after that.
Thanx... I'll give that a go...