4

I have a time lapse of thousands of jpgs and would like to know if its possible to list only the shots taken during daylight hours? So it's not about listing the files between two dates, but listing the files between two hours on any date. eg: between 6am and 6pm.

Can I do this using find?

AReddy
  • 3,172
  • 5
  • 36
  • 76
  • A similar idea is in: https://unix.stackexchange.com/q/468510/117549; the answer(s) there could be adapted with tools that read EXIF as the date-extractor. – Jeff Schaller Sep 12 '18 at 13:57

2 Answers2

2

this command worked for me

find . -iname "*pg" -printf '%Tc %p\n' | grep "\ 08:\|\ 07:\| \06:"

it is nonetheless the files' unix timestamps not the exif data timestamp which is used for the search and I am unsure about performance, but I gave this answer as you indicated findutils as a tag

2

If your files have EXIF data that includes the creation date and time, then you can use exiftool to list just the hour and filename, and filter on that:

find . -name '*jpg' -exec exiftool -q -d '%H' -p '$CreateDate $filename' \; 2>/dev/null |
awk '$1>=6 && $1<18 {$1=""; print}'

Beware, check if the date/time in the files is in local time or UTC with a timezone offset first. Run exiftool -CreateDate on a single file and the output will be something like

Create Date   : 2013:06:19 14:03:13+08:00

if it has an offset (+8 hours in this example).

meuh
  • 51,383