1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
opendir( DIR, 'c:\\test\\' );
@files = readdir(DIR);
closedir(DIR);
my $exifTool;
foreach $file (@files) {
next if $file !~ /\.jpg$/i;
print "processing file '$file'\n";
$exifTool = new Image::ExifTool;
my $info = $exifTool->ImageInfo($file);
foreach $key ( keys %$info ) {
print "$file => $key=> $$info{$key}\n";
}
}
my $info = $exifTool->ImageInfo("Landscape_2.jpg");
$exifTool->SetNewValue( "Model", "0815333" );
( $success, $errStr ) = $exifTool->WriteInfo("Landscape_2.jpg");
print "SUCCESS: $success\n";
print "ERROR: $errStr\n";
1 2 3 4 5 6 7 8
sub getFilesToProcess { my $path = shift; opendir my $dh, $path or die "Opendir fehlgeschlagen für $path!\n"; return map { "$path/$_" } grep /\.jpg$/i, readdir $dh; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
use Image::ExifTool; use File::Find; my $exifTool; # search and find File::Find::find ( # für jede Datei im Verzeichnis rufe diese Sub auf sub { my $file = $File::Find::name; if ($file =~ /\.jpg$/i) { say "$file found"; $exifTool = Image::ExifTool->new; my $info = $exifTool->ImageInfo($file); foreach my $key ( keys %$info ) { print "$file => $key=> $$info{$key}\n"; } } }, # in Verzeichnis C:\test\ 'C:/test/' );
say for File::Find::Rule->maxdepth(1)->file()->name(qr/\.jpg$/i)->in("/suchverzeichnis")
say for </verzeichnis/*.jpg>
1 2 3 4 5 6 7
for my $file (glob('C:/test/*.jpg')) { print "$file found\n"; my $info = Image::ExifTool->new()->ImageInfo($file); foreach my $key ( keys %$info ) { print "$file => $key=> $$info{$key}\n"; } }
1 2 3 4
use Path::Class; my $dir = dir("c:\\test"); my @jpegs = grep {$_->basename =~ /[.]jpg$/} $dir->children; say for @jpegs;