ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Sanje on September 17, 2022, 12:08:17 PM

Title: Date / time
Post by: Sanje on September 17, 2022, 12:08:17 PM
Hi ! I am using exif tool to name photos and want to insert the original date of creation of the photo but dont want the time. If there is a way to do that please advise. Many Thanks
Title: Re: Date / time
Post by: wywh on September 17, 2022, 12:55:51 PM
How do you want to treat images taken on the same date? Try something like:

exiftool -fileOrder FileName '-FileName<DateTimeOriginal' -d '%Y-%m%d%%lc.%%e' .
I prefer seconds:

exiftool -fileOrder FileName '-FileName<DateTimeOriginal' -d '%Y-%m%d-%H%M-%S%%lc.%%e' .
- Matti
Title: Re: Date / time
Post by: Sanje on September 17, 2022, 10:59:33 PM
Thanks. I am using the original number sequence from the shoot.For example the original name was abc_1950. The images were 1950, 51, 52 etc.. I dont want the time and only the date because it makes the name too long
Title: Re: Date / time
Post by: Sanje on September 17, 2022, 11:09:32 PM
Images from the same date have unique sequential numbers. The time of the shot is redundant. How do I extract just the date?
Title: Re: Date / time
Post by: StarGeek on September 18, 2022, 08:20:22 PM
You use the -d (-dateFormat) option (https://exiftool.org/exiftool_pod.html#d-FMT--dateFormat) similar to wywh's first command.  See Common Date Format Codes (https://exiftool.org/filename.html#codes).  For details on %f/%e see the -w (-TextOut) option (https://exiftool.org/exiftool_pod.html#w-EXT-or-FMT--textOut).

To keep part of the original name, you would have to either add %%f to the date format string or add %f to the tag copy part and add a dollar sign before DateTimeOriginal

exiftool '-FileName<DateTimeOriginal' -d '%%f %Y-%m%d.%%e' /path/to/files/
or
exiftool '-FileName<%f $DateTimeOriginal.%e' -d '%Y-%m%d' /path/to/files/

You give an example of how your files are currently named, but not how you want them to end up.  I just added the a space and then the date in the above commands.

The above commands use single quotes and will work on Linux/Mac/Powershell.  If you're using Windows CMD, change the single quotes into double quotes.