Main Menu

-sep not working

Started by filbe, April 30, 2023, 10:19:41 PM

Previous topic - Next topic

filbe

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

filbe

#1
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

StarGeek

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.
"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

filbe

Thanks
I tried using a separator of ##
-sep "## "
but still get keywords all concatenated e.g. "Michaela## UK"

Cheers
Phil

Phil Harvey

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

StarGeek

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.
"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

filbe

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

Phil Harvey

The ExifTool option to keep the process from terminating is -k not /K

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