Apply advanced formatting to multiple files

Started by ryerman, May 21, 2013, 12:54:32 AM

Previous topic - Next topic

ryerman

I am trying to use an advanced formatting expression with the -p option, for multiple files.
The command line I'm using seems to apply the formatting expression to only 1 file.

How can the -p option, modified by a formatting expression, be applied to multiple files with the same command line?


Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
Active code page: 1252

F:\>exiftool -ver
9.29

F:\>exiftool -p $filesize file1.jpg file2.jpg
89 kB
105 kB
    2 image files read

F:\>exiftool -p "${filesize;s/kB/kilobytes/}" file1.jpg file2.jpg
89 kilobytes
    2 image files read
89 kilobytes
F:\>


Thanks,
Jim
Windows 10 Home 64 bit, Exiftool v12.61

Phil Harvey

#1
Hi Jim,

But it did work for both files.

You may be confused because it seems that stderr is getting flushed before stdout, so the "2 image files read" line comes out of sequence.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ryerman

Hi Phil.

I am confused.
file1.jpg is 89 kB and file2.jpg is 105 kB.  I showed this in my previous example.
If the "2 image files read" line is merely out of sequence, I expect this:

F:\>exiftool -p "${filesize;s/kB/kilobytes/}" file1.jpg file2.jpg
89 kilobytes
    2 image files read
105 kilobytes

Here's another example:
F:\>exiftool -p "$filename    ${filesize;s/kB/kilobytes/}" file1.jpg file2.jpg
file1.jpg    89 kilobytes
    2 image files read
89 kilobytes
F:\>


Why is the filename and filesize for file2.jpg not shown in the output?

Thanks,
Jim
Windows 10 Home 64 bit, Exiftool v12.61

Phil Harvey

Hi Jim,

Ooops.  I totally missed that.

Weird.

I'll look into this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

Good catch!  That was a bug.  It will be fixed in 9.30.

The fix also fixes the ordering problem in the output.

Thanks for pointing this out!

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

ryerman

Thank you Phil.

Adding the advanced formatting functionality was a great idea.  I'll look forward to the fix.

Thanks again for the outstanding support.

Jim
Windows 10 Home 64 bit, Exiftool v12.61

ryerman

The fix is in.
Advanced formatting worked correctly for multiple files in ver 9.30.

Thanks
Windows 10 Home 64 bit, Exiftool v12.61

Phil Harvey

Hi Jim,

Glad it worked.  Thanks for the confirmation.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).