overwrite metadata export files

Started by hvdwolf, December 14, 2012, 04:53:55 AM

Previous topic - Next topic

hvdwolf

Hi,
(Sorry if the answer is somewhere in this forum or in the application documentation but I simply couldn't find it.)

I've just added export metadata options to my pyExifToolGUI program, which as such is easy enough, but I'm running into an overwrite problem for the export files.
Say I want to export to xml using (in shell script now; shortest example):
for i in *.jpg; do exiftool -w xml -X -all "$i"; done
This works fine. However, when I do it a second time on the same images, exiftool doesn't want to overwrite the earlier created .xml files.
There are of course several work arounds by using something like:
for i in *.jpg; do exiftool -X -all "$i" > basename("$i").xml ; done
or
for i in *.jpg; do exiftool -X -all "$i" > $i.xml ; done
(I even prefer the second one in case you have for example image.cr2, image.tif and image.jpg and do a "for i in <All image types>", thereby creating image.cr2.xml, image.tif.xml and image.jpg.xml)

Question:  Is there some equal command/option like "-overwrite_original_in_place" for these export files (be it txt, tabbed txt, xml, csv, etc.)
See my jExifToolGUI cross-platform java application (Website, Releases, Changelog) for Phil's marvelous exiftool.

Phil Harvey

The answer is in the -w option documentation:

            Existing files will not be overwritten unless an exclamation point
            is added to the option name (ie. -w! or -textOut!).


- 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 ($).

hvdwolf

Thanks. Found it now.
Suggestion for the Option summary:
"-w[!] EXT   (-textOut)           Write output text files"
could perhaps be
"-w[!] EXT   (-textOut)           (Over)Write output text files"
or
"-w[!] EXT   (-textOut)           (Over[!])Write output text files"

That would make it more clear for users who don't search carefully enough  :-[
See my jExifToolGUI cross-platform java application (Website, Releases, Changelog) for Phil's marvelous exiftool.

Phil Harvey

Thanks for the suggestion, but I think we need to be careful here or some people will think this command always overwrites the files.  This would be great:

  -w[!] EXT   (-textOut)           Write (-w) or overwrite (-w!) output text files

except the line is too long.

How about this?:

  -w[!] EXT   (-textOut)           Write (or overwrite!) output text files

- 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 ($).

hvdwolf

Is
-w[!] EXT   (-textOut)           Write (-w) (overwrite -w!) output text files
too long (3 characters shorter) ?

If still too long, your second option is best.
See my jExifToolGUI cross-platform java application (Website, Releases, Changelog) for Phil's marvelous exiftool.

Phil Harvey

Quote from: hvdwolf on December 14, 2012, 11:41:39 AM
Is
-w[!] EXT   (-textOut)           Write (-w) (overwrite -w!) output text files
too long (3 characters shorter) ?

Yup.  Still 3 characters too long.  So I'll go with my last suggestion.

Thanks.

- 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 ($).