ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: kbellis on January 29, 2014, 07:58:50 PM

Title: What is the proper syntax for writing to separate files?
Post by: kbellis on January 29, 2014, 07:58:50 PM
In this example:
echo "BaseName<tab>Date<tab>Time_into_x<tab>LightValue_into_y" > %1\test.cor
C:\ExifTool\exiftool -config C:\ExifTool\.test_config -T -r -n -basename -Time_into_x -LightValue_into_y %1 >> %1\test.cor


the result is a single report (test.cor) which contains the requested and recursive data into a single collective file. But what if you want to write that requested and recursive data into individual discrete files prefixed with the file name; e.g.:

BaseName0001_test.cor
BaseName0002_test.cor
BaseName0003_test.cor
etc.,


What is the proper syntax in the call(s) from the .bat file?

Thank you for any reply.

Kelly
Title: Re: What is the proper syntax for writing to separate files?
Post by: Phil Harvey on January 30, 2014, 07:23:33 AM
Hi Kelly,

Is there one output text file per image (ie. do you want to store the output files in a flat directory, and are there duplicate source files with the same name)?

Do you want the header row to be written to each output file?

- Phil
Title: Re: What is the proper syntax for writing to separate files?
Post by: kbellis on January 30, 2014, 08:46:34 AM
Hi Phil,

Thanks for the reply.

Actually, the echo / header call isn't necessary for each output file; and yes, one output file per image.

The source file; e.g., 4567.cr2 and the output file, again for example, 4567_test.cor would be in the same directory.

Kelly
Title: Re: What is the proper syntax for writing to separate files?
Post by: Phil Harvey on January 30, 2014, 08:53:29 AM
Hi Kelly,

OK then, this is easy:

exiftool -config C:\ExifTool\.test_config -T -r -n -basename -Time_into_x -LightValue_into_y -w %d%f_test.cor %1

(if you didn't want the "_test" added, it would have been simpler: "-w cor")

- Phil
Title: Re: What is the proper syntax for writing to separate files?
Post by: kbellis on January 30, 2014, 09:00:11 AM
Wow - powerful and so elegant in simplicity.

Thanks Phil!

Kelly
Title: Re: What is the proper syntax for writing to separate files?
Post by: Phil Harvey on January 30, 2014, 09:02:08 AM
Hi again,

Ooops.  I just realized you are using this in a .BAT file, so the "%" characters need to be doubled:

exiftool -config C:\ExifTool\.test_config -T -r -n -basename -Time_into_x -LightValue_into_y -w %%d%%f_test.cor %1

- Phil
Title: Re: What is the proper syntax for writing to separate files?
Post by: kbellis on January 30, 2014, 09:09:06 AM
I actually used the simpler:
C:\ExifTool\exiftool -config C:\ExifTool\.test_config -T -r -n -basename -Time_into_x -LightValue_into_y -w cor %1
and the bat ran without issue (except I forgot about some sub-directories that I had later added and the recursive part worked there too ;) )

Noting: I didn't double up the percentage character and it worked fantastically - as advertised :)
Title: Re: What is the proper syntax for writing to separate files?
Post by: Phil Harvey on January 30, 2014, 09:17:35 AM
Right.  My last post doesn't apply if you use the simple "-w cor".

Glad it worked.

- Phil