ExifTool Forum

ExifTool => Newbies => Topic started by: luusac on December 07, 2016, 01:06:37 PM

Title: extracting dates
Post by: luusac on December 07, 2016, 01:06:37 PM
Hi,
I want to extract the Date Taken from all .jpg in a directory and end up with a list of filenames sorted by that date in a text file.  The list could be of the format

image name  date taken

or simply

image name

The examples in the documentation seem to more concentrate on doing something with that date info - i.e. moving the files to subdirectories based on dates.  What I am looking for is much simpler - just a sorted output to a text file.  I hope someone can help with this newbie question.
thanks
Title: Re: extracting dates
Post by: Hayo Baan on December 07, 2016, 01:16:27 PM
Indeed quite simple :D
exiftool -T -FileName -DateTimeOriginal FILESorDIR
This will output the name of the file, a tab, and the date&time the image was taken at.

As you want to sort that, you might as well put the date first as then you can pipe the output through sort directly:
exiftool -T -DateTimeOriginal -FileName FILESorDIR | sort
(assuming your OS has a sort utility)
Title: Re: extracting dates
Post by: StarGeek on December 07, 2016, 02:25:36 PM
There's also the FileOrder (http://www.exiftool.org/exiftool_pod.html#fileorder_tag) option.
Title: Re: extracting dates
Post by: luusac on December 07, 2016, 02:31:33 PM
I had also come across these examples in the docs:
     
exiftool -T -createdate . > out.txt
exiftool -p '$filename has date $dateTimeOriginal' -q -f .
exiftool -d "%r %a, %B %e, %Y" -DateTimeOriginal -S -s *.jpg


My images have a Date/Time Original and a CreateDate.  I take it that 'Date/Time Original' is what Windows calls 'Date Taken' in Windows Explorer?

I am using Ubuntu for this though, so your sort did the job exactly, thank you Hayo Baan.   I will look up the FileOrder option too, thanks StarGeek.

Title: Re: extracting dates
Post by: StarGeek on December 07, 2016, 02:56:14 PM
Quote from: luusac on December 07, 2016, 02:31:33 PM
My images have a Date/Time Original and a CreateDate.  I take it that 'Date/Time Original' is what Windows calls 'Date Taken' in Windows Explorer?

Yes, conditionally.

Windows will use DateTimeOriginal first if it's in the EXIF group, but last if it's in the XMP group.  CreateDate (XMP and EXIF) are in between.  See this chart (https://exiftool.org/forum/index.php/topic,6591.msg32875.html#msg32875).

The EXIF:DateTimeOriginal tag is much more likely to be set and the case of XMP:DateTimeOriginal being set and not EXIF:DateTimeOriginal is probably not likely to happen using most software.