Can %f be used with -p ?

Started by wrandyr, January 30, 2011, 01:27:11 AM

Previous topic - Next topic

wrandyr

I am trying to export to a database via a CSV file. Some of the database fields are derived from the filename, some from the metadata.

exiftool -p ' |$%f|%f|$%-5.3f000|"$IPTC:headline"|"$IPTC:OriginalTransmissionReference"|"$IPTC:By-line"|"$IPTC:Source"|"$IPTC:Caption-Abstract"| ' -w .txt SBBG_BD_90916.jpg

gives me a text file containing

|$%f|%f|$%-5.3f000|"IPTC_Headline"|"1977-00-00"|"11"|"IPTC_Source"|"44"|

The %f is taken literally, while the metadata fields are reported as I wish. I have tried a number of combinations of single and double quotes around the %f segments, but I am beginning to suspect that this feature is only applicable when creating or renaming files. Am I missing something?


Phil Harvey

%f is expanded only in arguments where a file name is expected.

Instead, you can use $filename in your -p argument, but you will have to create a user-defined tag in order to extract substrings from the filename with -p.

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