all tags include filename on one line

Started by Tartopom3, August 15, 2014, 08:29:14 AM

Previous topic - Next topic

Tartopom3

Hi everybody,

I have thousands jpg files in folders

I wanted exiftool to return me the list of files which have been created in 2012 (for example).

i tried a command like that 
$ exiftool -d '%Y' -DateTimeOriginal -r -s -S  *

which produces a "nearly" correct output, but i would like the filename + year printed on a **single line** (with a separator ':' or \t) (to be grep-able in a bash shell)

Thanks for any help
Best regards,

Tartopom3

Oh oh...

i tried something like that....

$ exiftool -d '%Y' -FileName -DateTimeOriginal -p '$FileName:$DateTimeOriginal' -r -s -S  *

which produced something correct!

Regards
Paul

Hayo Baan

Quote from: Tartopom3 on August 15, 2014, 08:46:25 AM
Oh oh...

i tried something like that....

$ exiftool -d '%Y' -FileName -DateTimeOriginal -p '$FileName:$DateTimeOriginal' -r -s -S  *

which produced something correct!

Very good, you can actually simplify the command as follows:
exiftool -d '%Y' -T -FileName -DateTimeOriginal -r *

And if you want to also filter for e.g., a specific year, you can also add an -if to the line:
exiftool -d '%Y' -T -FileName -DateTimeOriginal -r * -if '$DateTimeOriginal == 2012'

If you want to be even more specific and also filter for a date you can, but then you'll need to make use of the unconverted DateTimeOriginal (as your -d stripped off everything else) like so:
exiftool -d '%Y' -T -FileName -DateTimeOriginal -r * -if '$DateTimeOriginal# =~ /^2012:05:19/'
The # after the tag name makes sure the value is the unconverted value, and =~ /^2012:05:1[1-8]/ then matches any datetime that is from 11 till 18 May 2012.

Cheers,
Hayo

Hayo Baan – Photography
Web: www.hayobaan.nl