diff options
Diffstat (limited to 'exiftool')
-rwxr-xr-x | exiftool | 33 |
1 files changed, 27 insertions, 6 deletions
@@ -10,7 +10,7 @@ use strict; require 5.004; -my $version = '12.18'; +my $version = '12.19'; # add our 'lib' directory to the include list BEFORE 'use Image::ExifTool' my $exeDir; @@ -163,6 +163,7 @@ my $isWriting; # flag set if we are writing tags my $joinLists; # flag set to join list values into a single string my $json; # flag for JSON/PHP output format (1=JSON, 2=PHP) my $langOpt; # language option +my $listDir; # treat a directory as a regular file my $listItem; # item number for extracting single item from a list my $listSep; # list item separator (', ' by default) my $mt; # main ExifTool object @@ -691,7 +692,7 @@ for (;;) { } else { # 'g(\d*)' # list all groups in specified family my $family = $2 || 0; - PrintTagList("Groups in family $family", GetAllGroups($family)); + PrintTagList("Groups in family $family", $mt->GetAllGroups($family)); } next; } @@ -876,6 +877,7 @@ for (;;) { } (/^D$/ or $a eq 'decimal') and $showTagID = 'D', next; /^delete_original(!?)$/i and $deleteOrig = ($1 ? 2 : 1), next; + /^list_dir$/i and $listDir = 1, next; (/^e$/ or $a eq '-composite') and $mt->Options(Composite => 0), next; (/^-e$/ or $a eq 'composite') and $mt->Options(Composite => 1), next; (/^E$/ or $a eq 'escapehtml') and require Image::ExifTool::HTML and $escapeHTML = 1, next; @@ -2708,7 +2710,7 @@ sub SetImageInfo($$$) return 0; } } - if (not $isStdout and ($et->IsDirectory($outfile) or $outfile =~ /\/$/)) { + if (not $isStdout and (($et->IsDirectory($outfile) and not $listDir) or $outfile =~ /\/$/)) { $outfile .= '/' unless $outfile =~ /\/$/; my $name = $file; $name =~ s/^.*\///s; # remove directory name @@ -2911,6 +2913,10 @@ sub SetImageInfo($$$) unless (defined $tmpFile) { # count the number of tags and pseudo-tags we are writing my ($numSet, $numPseudo) = $et->CountNewValues(); + if ($numSet != $numPseudo and $et->IsDirectory($file)) { + print $vout "Can't write real tags to a directory - $infile\n" if defined $verbose; + $numSet = $numPseudo; + } if ($et->Exists($file)) { unless ($numSet) { # no need to write if no tags set @@ -3585,7 +3591,7 @@ sub ProcessFiles($;$) ++$progressCount; $progStr = " [$progressCount/$progressMax]" if $progress; } - if ($et->IsDirectory($file)) { + if ($et->IsDirectory($file) and not $listDir) { $multiFile = $validFile = 1; ScanDir($et, $file, $list); } elsif ($filterFlag and not AcceptFile($file)) { @@ -3689,7 +3695,7 @@ sub ScanDir($$;$) $dir =~ /\/$/ or $dir .= '/'; # make sure directory name ends with '/' foreach $file (@fileList) { my $path = "$dir$file"; - if ($et->IsDirectory($path)) { + if ($et->IsDirectory($path) and not $listDir) { next unless $recurse; # ignore directories starting with "." by default next if $file =~ /^\./ and ($recurse == 1 or $file eq '.' or $file eq '..'); @@ -4624,6 +4630,7 @@ L<Advanced options|/Advanced options> -echo[NUM] TEXT Echo text to stdout or stderr -efile[NUM][!] ERRFILE Save names of files with errors -execute[NUM] Execute multiple commands on one line + -list_dir List directories, not their contents -srcfile FMT Process a different source file -stay_open FLAG Keep reading -@ argfile even after EOF -userParam PARAM[[^]=[VAL]] Set user parameter (API UserParam opt) @@ -5369,7 +5376,7 @@ with this command: produces output like this: - -- Generated by ExifTool 12.18 -- + -- Generated by ExifTool 12.19 -- File: a.jpg - 2003:10:31 15:44:19 (f/5.6, 1/60s, ISO 100) File: b.jpg - 2006:05:23 11:57:38 @@ -6351,6 +6358,20 @@ line. I<NUM> is an optional number that is echoed in the "{ready}" message when using the B<-stay_open> feature. If a I<NUM> is specified, the B<-q> option no longer suppresses the output "{readyNUM}" message. +=item B<-list_dir> + +List directories themselves instead of their contents. This option +effectively causes directories to be treated as normal files when reading +and writing. For example, with this option the output of the C<ls -la> +command on Mac/Linux may be approximated by this exiftool command: + + exiftool -list_dir -T -ls-l -api systemtags -fast5 .* * + +(The B<-T> option formats the output in tab-separated columns, B<-ls-l> is a +L<shortcut tag|Image::ExifTool::Shortcuts>, the API SystemTags option is +required to extract some necessary tags, and the B<-fast5> option is added +for speed since only system tags are being extracted.) + =item B<-srcfile> I<FMT> Specify a different source file to be processed based on the name of the |