Importing Tags from JSON file

Started by ProAssist, May 16, 2016, 01:21:20 PM

Previous topic - Next topic

ProAssist

I am trying to export all tags of jpeg files in a directory, modify the json file and then import the tags back into the original files.
So far I can export the metadata to a json file using exiftool -args -json -n *.j* >args.json
I have a program that modifies the tag settings in the json file but I can not figure out how to import the tags back into the original files.
I can import the tags for a single file using exiftool -json=args.json -n 1461087229340.jpg where args.json contains the tags of a single file with the SourceFile tag set to the file name 1461087229340.jpg but I can not figure out how to import the multi record json file created by the exiftool -args -json -n *.j* >args.json command.  Is there a command that can read the json file with multiple records and set the tags for each SourceFile contained in the json file?

Thanks

Phil Harvey

First, the -args output option is ignored because you are specifying the -json output format.  (It only makes sense to specify one format.)

Then to answer your question, the import of a multi-record JSON file is exactly the same as for a single file.  The following 2 commands write the json file then read it back in:

exiftool -json FILE1 FILE2 FILE3 ... > out.json

exiftool -json=out.json FILE1 FILE2 FILE3 ...

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

ProAssist

#2
I need to process over 1000 files at a time and the command line might be to large for windows to handle - is there any way to use wildcards or read the file names from a file?

Can I use:
exiftool -json *.j* >out.json

exiftool -json=out.json <listoffiles.txt

Thanks

StarGeek

For a text file with a list of files, you can use -@ listoffiles.txt for either case.

Using a asterisk as a wildcard will also work, but only for the specified directory, not for any recursion option.  For example, in your command, *.j* will only process files in the current directory that have .j in them. Note that means anywhere in the file name, not just files with .j as part of the extension, for example it would include a file named Smith.John.tif

You should look into the -r option if you want to recurse into subdirectories and the -ext option if you want to limit the files processed by the extension.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype