There's an awful lot in your script which doesn't need to be there. Here's a stripped down version with none of the unnecessary modules, no commented-out code, indented loops and no BEGIN blocks. Oh, and it has strict as should every script you ever write.
#!/usr/bin/env perl use strict; use warnings; use Image::ExifTool 'ImageInfo'; print "#################################\n"; my $sort = "/tmp/"; chdir $sort or die "Cant chdir to $sort $!"; my @sort_list = glob "*.jpeg"; my $exifTool = Image::ExifTool->new; my @tags = qw(DateTimeOriginal); foreach my $file (@sort_list) { $exifTool->Options(Duplicates => 0, DateFormat => '%m-%d-%Y'); my $info = $exifTool->ImageInfo($file, \@tags); foreach (@tags) { print "$file $_: $info->{$_}\t" if exists $info->{$_}; } print "\n"; }
This works fine for a collection of jpegs I've put in /tmp for testing (I have no use for .psd files). It produces no errors and no warnings and a nice list of original dates in day-in-the-middle format (your choice, not mine).
In reply to Re^3: date created in exiftool
by hippo
in thread date created in exiftool
by flieckster
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |