Limbic~Region has asked for the wisdom of the Perl Monks concerning the following question:
I haven't really coded in years so while this once seemed like a trivial task, I am having issues getting the expected results.
#!/usr/bin/perl use strict; use warnings; use File::Find::Rule; use Image::ExifTool qw(:Public); my $tool = Image::ExifTool->new(); for my $file (File::Find::Rule->file()->name( qr/\.(jpeg|jpg)$/i)->in( +'/')) { my $info = ImageInfo($file, 'DateTimeOriginal'); my $date = $info->{DateTimeOriginal}; next if ! $date || $date !~ /^2015/; print "$file\t$date\n"; }
When I tried it in my home directory as a test, it did exactly what I expected but when I changed '.' to '/' it started generating every file on the system (directories, text files, etc.) without the date.
Cheers - L~R
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Find Photos Taken During A Certain Time Range
by haukex (Archbishop) on Jul 30, 2020 at 19:18 UTC | |
Re: Find Photos Taken During A Certain Time Range
by Fletch (Bishop) on Jul 30, 2020 at 19:37 UTC | |
by flexvault (Monsignor) on Jan 08, 2021 at 21:24 UTC | |
Re: Find Photos Taken During A Certain Time Range
by bliako (Abbot) on Jul 30, 2020 at 19:23 UTC |