Can't import metadata from CSV to JPGs

Started by Glorious1, September 23, 2024, 10:35:27 AM

Previous topic - Next topic

Glorious1

I'm using exiftool 10.98 on the commandline (Terminal) in macOS 15.0 (Sequoia).

I cannot for the life of me get metadata from a CSV into a jpg. I've read the relevant documentation, many forum posts, and have tried everything I can think of. EVERY attempt results in
~/Documents/family_history: exiftool -k -csv=exiftool.csv exifslides

    1 directories scanned
    0 image files read

I am cd'd into the family_history directory, as you can see. It contains my CSV file (exiftool.csv), a directory (test) with the source images (Slide01.jpg and Slide13.jpg), and an output directory (exifslides).

In it's simplest form, exiftool.csv looks like this:
SourceFile,Caption-Abstract
test/Slide01.jpg,This is a caption 01
test/Slide13.jpg,This is a caption 13

I know exiftool is finding the CSV because if I change the name, it tells me it can't find it. Even using -v5 in the command shows no more information. I've tried all kinds of single and double quotes around the arguments and captions, trailing slash on the output directory, and verified the directory structure and filenames many times.

I've  been trying this for days.  Please help.

StarGeek

I believe you are assuming that exiftool is going to look in subdirectories for the files. It does not do this without the -r (-recurse) option. The response of
    1 directories scanned
    0 image files read
tells you it has only looked in the current directory for files.

The CSV file is not a list of files to process. It is a lookup table. When exiftool is given a file, it looks in the CSV file to see if it is listed and has data that needs to be added.
"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

Glorious1

#2
Thank you. Yes, I completely misunderstood how it works. It seemed logical to assume that you're giving it the path and filenames in the csv so it knows what files to process. I didn't notice anything in the docs that describes that behavior.

So how can I tell exiftool what directory to look in for image files?  I don't want to just use -r, because it would be looking also in some directories that would mess things up.  One way might be to cd into the source file directory, and give it absolute paths to the csv and destination directory.  But is there a way to specify a source directory instead?

EDIT: well heck, even using -r doesn't seem to help:
~/Documents/family_history: exiftool -v5 -k -r -csv=exiftool.csv exifslides

Reading CSV file exiftool.csv
Imported entry for 'test/Slide13.jpg' (full path: '/Users/jim/Documents/family_history/test/Slide13.jpg')
Imported entry for 'test/Slide01.jpg' (full path: '/Users/jim/Documents/family_history/test/Slide01.jpg')
    1 directories scanned
    0 image files read
I guess I still don't understand how it works.

StarGeek

Quote from: Glorious1 on September 23, 2024, 02:19:20 PMI didn't notice anything in the docs that describes that behavior.

From the docs on the -csv option
QuoteWhen importing from a CSV file, only files specified on the command line are processed. Any extra entries in the CSV file are ignored.

QuoteSo how can I tell exiftool what directory to look in for image files?  I don't want to just use -r, because it would be looking also in some directories that would mess things up.

Using -r shouldn't be a problem. If exiftool encounters a file that's not in the CSV it will be skipped and a No SourceFile <File.jpg> in imported CSV database warning is issued. Unless you use the an asterisk, as that will be applied to all file that are listed on the command line. Note that this isn't a wildcard in the usual sense.

The path under "Sourcefile" either needs to be an absolute path or a path relative to the current directory. Assuming the full path would be
/Users/jim/Documents/family_history/exifslides/test/Slide13.jpg
and the CSV file has
test/Slide13.jpg
then you need to CD ito /exifslides/ and your command line should look like this, using a dot for the current directory
~/Documents/family_history/exifslides: exiftool -v5 -k -r -csv=/path/to/exiftool.csv .
"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

Glorious1

Thank you for your patience.  I think I confused you with 'exifslides'.  It is not part of the path to source images.  It is a subfolder I intended to recieve the output images. But your response showed me the big error I was making.

Now I see that the directory after -csv=exiftool.csv is actually where it looks for source images.  And I missed the -o (-out) to designate the output directory.

Now this works perfectly:
exiftool -v2 -csv='exiftool.csv' 'test/' -out 'exifslides/'
Sorry for the confusion and my ignorance.  Thank you for your valuable help  :)