Can I rename files with both the UTC time and local time in one command?

Started by delerious, April 13, 2023, 04:30:16 AM

Previous topic - Next topic

delerious

So this works to print out the UTC time with subseconds:

exiftool -p "${SubSecCreateDate#;use POSIX qw(strftime);DateFmt('%s');$_=strftime('%Y-%m-%d_%H-%M-%S',gmtime($_))}.${SubSecTimeDigitized}" h:\IMG_3175.JPG
But would it be possible to print out other tags as well? When I tried this, it still only prints out the UTC time with subseconds:

exiftool -CreateDate -p "${SubSecCreateDate#;use POSIX qw(strftime);DateFmt('%s');$_=strftime('%Y-%m-%d_%H-%M-%S',gmtime($_))}.${SubSecTimeDigitized}" h:\IMG_3175.JPG

Phil Harvey

You can add other tags in the -p argument, like this:

exiftool -p "$createdate ${SubSecCreateDate#;use POSIX qw(strftime);DateFmt('%s');$_=strftime('%Y-%m-%d_%H-%M-%S',gmtime($_))}.${SubSecTimeDigitized}" h:\IMG_3175.JPG
- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).