ExifTool Forum

ExifTool => Newbies => Topic started by: filbe on April 30, 2023, 10:19:41 PM

Title: -sep not working
Post by: filbe on April 30, 2023, 10:19:41 PM
Hi,
Thanks again for this great tool.

I seem to be getting erratic results - something works one day then not the next.
Most annoying is I thought I had cracked using -sep to separate keywords; but it's not - keywords are written as one long text.

Here's the command line used:
C:\PHOTOS\exiftool -csv=C:\PHOTOS\LoadKeywords.csv -sep ', ' -overwrite_original C:\PHOTOS\1980

The first few lines of the csv file:
SourceFile,Keywords
C:\PHOTOS\1980\19-064.jpg,"Michaela, UK"
C:\PHOTOS\1980\19-066.jpg,"Marion, Mark, Michaela, UK"

and the VBA code used to run the command:
sCmd = sRoot & "\exiftool -csv=" & sRoot & "\LoadKeywords.csv -sep ', ' -overwrite_original " & sRoot & "\" & sPath
vReturn = Shell(sCmd, vbNormalFocus)

Cheers
Phil
Title: Re: -sep not working
Post by: filbe on May 01, 2023, 12:22:42 AM
I've tried moving the -sep to be the first command - no change.

Also tried not wrapping keywords in "" eg:
SourceFile,Keywords
C:\PHOTOS\1980\19-064.jpg,Michaela, UK

But now only writes first keyword; others ignored.

Cheers
Phil
Title: Re: -sep not working
Post by: StarGeek on May 01, 2023, 03:19:37 AM
What are you using to double check that the keywords are a single string and not separate?

Everything works correctly here. When displaying the keywords, I use a different -sep to make the separation more obvious.

C:\>type temp.txt
SourceFile,Keywords
Y:\!temp\aaaa\Test3.jpg,"Michaela, UK"
Y:\!temp\aaaa\Test4.jpg,"Marion, Mark, Michaela, UK"

C:\>exiftool -P -overwrite_original -csv=temp.txt -sep ", " Y:\!temp\aaaa\
    1 directories scanned
    2 image files updated

C:\>exiftool -G1 -a -s -sep ## -keywords Y:\!temp\aaaa\
======== Y:/!temp/aaaa/Test3.jpg
[IPTC]          Keywords                        : Michaela##UK
======== Y:/!temp/aaaa/Test4.jpg
[IPTC]          Keywords                        : Marion##Mark##Michaela##UK
    1 directories scanned
    2 image files read

Quote from: filbe on May 01, 2023, 12:22:42 AMAlso tried not wrapping keywords in "" eg:
SourceFile,Keywords
C:\PHOTOS\1980\19-064.jpg,Michaela, UK

But now only writes first keyword; others ignored.

Quotes are needed to make sure the keywords are treated as a single entry.  Without them, a Comma Separated Values file is going to put the other keywords in a separate column, which will be ignored as there isn't a header with a tag name.
Title: Re: -sep not working
Post by: filbe on May 01, 2023, 04:25:03 AM
Thanks
I tried using a separator of ##
-sep "## "
but still get keywords all concatenated e.g. "Michaela## UK"

Cheers
Phil
Title: Re: -sep not working
Post by: Phil Harvey on May 01, 2023, 08:37:24 AM
StarGeek's point is that you can use a different separator when extracting the tag, and if the extracted value contains this new separator then the items were stored properly (separated in the file).

I hope this makes sense.

- Phil
Title: Re: -sep not working
Post by: StarGeek on May 01, 2023, 10:56:33 AM
Again, what are you using to double check.  Are you using -sep ## to view the output as I did?

Please copy/paste your exact command and output, duplicating the commands I did above.

If you're on Windows, you can drag across the test and right-click will copy to the clipboard.
Title: Re: -sep not working
Post by: filbe on May 02, 2023, 06:13:16 PM
Thanks StarGeek and Phil,

Finally got it working with
C:\PHOTOS\exiftool -csv=C:\PHOTOS\LoadKeywords.csv -sep # -overwrite_original C:\PHOTOS\2011

instead of
cmd.exe C:\PHOTOS\exiftool -csv=C:\PHOTOS\LoadKeywords.csv -sep '#' -overwrite_original C:\PHOTOS\2011

(removed cmd.exe and '' around separator)

Only minor issue is command window closes when done so can't see any error messages (/K does not work). But it's working so I don't have to re-enter 30,000 keywords - I'm happy 8^)

Put this down to different environment - Windows XP SP3 under VMWARE on a Mac with Mojave.

Thanks again for a great tool and your help.

Cheers
Phil
Title: Re: -sep not working
Post by: Phil Harvey on May 02, 2023, 08:43:40 PM
The ExifTool option to keep the process from terminating is -k not /K

- Phil