ExifTool Forum

ExifTool => Newbies => Topic started by: mbuzina on June 08, 2021, 09:50:04 AM

Title: Best method to generate a batch update
Post by: mbuzina on June 08, 2021, 09:50:04 AM
I am looking on preserving some data from a photo management application (Synology Moments), which will be replaced by another app which lacks some support (Synology Photos, no Subject Recognition anymore).I have some commands that extracts the keyword data for each file from the database, I want to use this to generate a script that, if possible works efficiently as it will have to update 150 K files or so (yes, they do have a backup).

What would be the best way to create such a batch? Does exiftool have a way to input tags from file for many different files (I have not found that in documentation and forum)? Should I generate perl commands?

What I do have is a list with "filename", "Keyword A, Keyword B, Keyword C" for each file I want to update.

Thanks for your help!
Title: Re: Best method to generate a batch update
Post by: Phil Harvey on June 08, 2021, 01:40:31 PM
See FAQ 26 (https://exiftool.org/faq.html#Q26).

I think you want to use CSV format.  All you should need to do is add a heading row: SourceFile,Subject

(assuming you want to write the keywords to XMP:subject)

Also, you should add -sep ", " to the command to split the keywords into individual entries.

- Phil
Title: Re: Best method to generate a batch update
Post by: mbuzina on June 09, 2021, 11:18:18 AM
Sounds great. So I setup a csv file as follows:
DourceFile,Subject
"/photo/holidays/2020-06-spain/IMG1234.jpg","Beach, Volleyball"
"/photo/holidays/2020-06-spain/IMG1235.jpg","Sea, Boat"
...


and the command would be:
exiftool -sep ", " -tagsFromFile myexporteddata.csv .

and it would work with the full path from the csv file? Great that seems easy!

Will it avoid creating duplicates? Or do I have to do Subject-=Subject Subect+=Subject to achieve that?
Title: Re: Best method to generate a batch update
Post by: Phil Harvey on June 09, 2021, 09:06:31 PM
The command will overwrite existing the Subject, so there shouldn't be duplicates unless they exist in your csv file.

- Phil
Title: Re: Best method to generate a batch update
Post by: mbuzina on June 10, 2021, 09:02:22 AM
Hmm, I just get No Writeable tags set from test.csv when I do this:
test.csv (snippet)
SourceFile,Subject
/volume1/photo/Urlaube/2021_06 Tennisreise Juist/IMG_6717.HEIC,"dreirad, einrad, fahrrad, massenverkehrsmittel, rad, transport, verkehrswesen, öffentliche verkehrsmittel, öffentlicher verkehr, bicycle, transportation, Juist Tennisreise Urlaub 2021_06, Tennisreise, Urlaub, Urlaub 2021, Urlaub mit Freunden"
/volume1/photo/Urlaube/2021_06 Tennisreise Juist/IMG_6714.HEIC,"dreirad, einrad, fahrrad, massenverkehrsmittel, rad, transport, verkehrswesen, öffentliche verkehrsmittel, öffentlicher verkehr, bicycle, transportation, Juist Tennisreise Urlaub 2021_06, Tennisreise, Urlaub, Urlaub 2021, Urlaub mit Freunden"
/volume1/photo/Urlaube/2021_06 Tennisreise Juist/IMG_6692.HEIC," essen und trinken, bier, drink, essen, getränk, lager, stout, beer, drink, food, Juist Tennisreise Urlaub 2021_06, Tennisreise, Urlaub, Urlaub 2021, Urlaub mit Freunden"


call:
exiftool -sep ", " -tagsFromFile test.csv .

Will try a bit more. Also tried relative path (did not work) and setting subject manually on a file (did work)

P.S.: I have seen the unquoted path with spaces - I tried relative as well, no spaces.
Title: Re: Best method to generate a batch update
Post by: Phil Harvey on June 11, 2021, 09:24:30 AM
Use the -csv option, not -tagsfromfile

- Phil