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 (https://exiftool.org/exiftool_pod.html) and my form seems to be correct.
I'm running exiftool 13.13 on MACos 15 M4
Thanks
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 (https://exiftool.org/exiftool_pod.html#d-FMT--dateFormat), 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 (https://exiftool.org/filename.html#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"
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'
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.