Copy photo - recognize create date

Started by Gus, June 11, 2025, 12:27:28 PM

Previous topic - Next topic

StarGeek

It has to do with the location of the percent signs.

The part that has two percent signs is part of the -d (-dateFormat) option. To avoid possible collisions between the date format codes (such as %f->fractional seconds) and the file format codes (%f->base filename), the file format codes have their percent signs doubled so they are not treated as date format codes. From Common Date Format Codes
QuoteExifTool file name format codes may be used inside a date format string when a date/time tag is used to set the value of the FileName or Directory tags via the command-line interface. In this case, an extra '%' must be added to pass the format code through the date/time parser:

It gets really messing in a Windows Bat file where all percent signs must be doubled again (see FAQ #27, My ExifTool command doesn't work from a Windows .BAT file).

Personally, I try to avoid putting the file percent codes in the date format string. It leads to confusion like this. But in doing so, that means text has to be mixed with tag names, which means the tag name must now have a dollar sign prefix, which can be a different point of confusion.

My version of the command would have been like this, removing the file format codes from the date format string.
exiftool -o . -d '/mnt/synology_foto_backup/User_1/Foto_Backup/%Y-%m-%B/%y-%m-%d %H.%M.%S' '-Filename=/mnt/synology_foto_backup/User_1/Foto_Backup/No_Create_Dates/%f%-2c.%e' '-filename<$DateCreated%+2nc.%e' '-filename<$CreateDate%+2nc.%e' /mnt/synology_homes/User_1/Foto_Nya

Either way works, so it's just a question of which style you prefer.
"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