1 |
Hello, |
2 |
|
3 |
On Wed, 30 Jan 2019, Laurence Perkins wrote: |
4 |
>for VIDEO in $(find . -xtype f -iname '*.mp4' -o -iname '*.avi'\ |
5 |
> -o -iname '*.mkv'); do |
6 |
> #Things in $() get run and their stdout gets stuffed into the |
7 |
> #command line at that point. ${} is how you insert variable values. |
8 |
> echo "${VIDEO},$(exiftool -T -ImageSize '${VIDEO}')" |
9 |
>done |
10 |
|
11 |
==== |
12 |
#!/usr/bin/perl -w |
13 |
use strict; |
14 |
use File::Find; |
15 |
use Image::ExifTool; |
16 |
use Encode; |
17 |
|
18 |
my $exifTool = new Image::ExifTool; |
19 |
|
20 |
sub wanted { |
21 |
if( -f $_ && $_ =~ /^.*\.(?:mp4|mkv|avi)\z/si ) { |
22 |
my $ii = $exifTool->ImageInfo($File::Find::name); |
23 |
printf("%s,%s\n", $File::Find::name, |
24 |
Encode::decode_utf8($ii->{ImageSize}) ); |
25 |
} |
26 |
} |
27 |
scalar @ARGV || push(@ARGV, '.'); |
28 |
File::Find::find({wanted => \&wanted, no_chdir => 1}, @ARGV ); |
29 |
==== |
30 |
|
31 |
Usage: $script [FILES_OR_DIRS...] |
32 |
|
33 |
HTH, |
34 |
-dnh |
35 |
|
36 |
-- |
37 |
>> This needs quotes: |
38 |
>> use lib "/path/to/perl/modules"; |
39 |
> Single or double quotes? |
40 |
Yes. -- Tad McClellan in comp.lang.perl.misc |