exiftool change in behavior between Windows and MACos

Started by DS256, February 06, 2025, 08:15:09 PM

Previous topic - Next topic

DS256

I had the following command install in a Windows BAT file to rename all files in a directory. It's been working for years

exiftool "-filename<CreateDate" -d "%Y%m%d_%H%M%S%-c.%e" .
I copied and modified the file to a MACos SH file but the renaming of the file changed.

On Windows, '_DSC4727.NEF' would have been changed to '20250206_175736.NEF'. On MACos, it is changed to 20250206_175736Thu  6 Feb 17:57:36 2025. 6'

I looked this documentation and my form seems to be correct.

I'm running exiftool 13.13 on MACos 15 M4

Thanks

StarGeek

As written, it should not have worked on Windows. Even less so in a BAT file.

When you are using the file name percent variables (the %c and %e) in a -d (-dateFormat) option, the percent signs must be doubled. In a bat file, percent signs must be doubled again, so your BAT file should have had this in order to work.
-d "%%Y%%m%%d_%%H%%M%%S%%%%-c.%%%%e"

Either %c or %e used directly will have a different meaning as a date format code. Only %c is listed under the Common Date Format Codes, so I assume that the "preferred locale date/time representation" on the Mac is the "Thu  6 Feb 17:57:36 2025" part.

Try this date option on the Mac
-d "%Y%m%d_%H%M%S%%-c.%%e"
"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

greybeard

Quote from: StarGeek on February 06, 2025, 08:42:44 PMTry this date option on the Mac
-d "%Y%m%d_%H%M%S%%-c.%%e"

or this date on the Mac:

-d '%Y%m%d_%H%M%S%%-c.%%e'

DS256

Quote from: StarGeek on February 06, 2025, 08:42:44 PMAs written, it should not have worked on Windows. Even less so in a BAT file.

Apologies, I should have mentioned I'd already modified the example for working in MACos. In Windows, the BAT was using %%.

Quote from: StarGeek on February 06, 2025, 08:42:44 PMTry this date option on the Mac
-d "%Y%m%d_%H%M%S%%-c.%%e"

Thanks. That works. I should have noted the %%-c and %%e in the example on the page you provided the link to.