ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: pixelpicker on September 16, 2011, 04:05:26 PM

Title: Import from csv file...
Post by: pixelpicker on September 16, 2011, 04:05:26 PM
Hello Phil,

I'm trying to import from csv file on the command line. I've already read the other topics for this here, but it doesn't help.

I created a csv file with (that worked):
exiftool -L -Caption-Abstract -csv "G:\server\diskw\www\gallery\data\0_KW\000_rein_Flora_1_JPEG_neu_KW\SICHERUNG BIlder groß" > "J:\server\diskw\www\gallery\data\0_KW\000_rein_rdens_Flora_1_JPEG_neu_KW\SICHERUNG BIlder groß\Caption.csv"

To try an import I used the same file for import:
exiftool -csv=Caption.csv -r "G:\server\diskw\www\gallery\data\0_KW\000_rein_Flora_1_JPEG_neu_KW\SICHERUNG BIlder groß"

For all files I get:

No SourceFile 'G:/server/diskw/www/gallery/data/0_KW/000_rein_Flora_1_JPEG_neu_KW/SICHERUNG BIlder gro▀/bw_kf200220.jpg' in imported CSV database

    1 directories scanned
    0 image files read

I tried to change the slashes into backslashes and vice versa, but bracklets around the path in the csv file. Nothing helped.
What am I doing wrong?

Thank you!

Greetings Bette

Title: Re: Import from csv file...
Post by: Phil Harvey on September 16, 2011, 05:42:49 PM
Hi Bette,

I'm afraid that you have fallen prey to the know problem with special characters in Windows filenames.  Try removing the non-ASCII characters in the directory and file names and I think it should work.

- Phil
Title: Re: Import from csv file...
Post by: pixelpicker on September 20, 2011, 07:10:55 AM
Dear Phil,

I removed all unusual charakters and I even put the directory in the root C: - it didn't help.
The last try looks like this:

Create csv with (works!):
exiftool -L -Caption-Abstract -csv "C:\AA" > "C:\AA\Caption_Neu.csv"

This Caption_Neu.csv inside:

SourceFile,Caption-Abstract
C:/AA/bw_kf200002.jpg,Z-B-N
C:/AA/bw_kf200003.jpg,"Gewöhnliche Kratzdistel, Lanzett-Kratzdistel - Cirsium vulgare, Cirsium lanceolatum, Asteraceae, Distel  - Lanceolatum Cirsium vulgare, Cirsium, Asteraceae"
C:/AA/bw_kf200220.jpg,"Sumpf-Kratzdistel  - Cirsium palustre, Cirsium palustre, Asteraceae, Distel  - The marsh thistle, Cirsium palustre, Cirsium palustre, Asteraceae"
...

Try to import from same csv-file with (doesn't work):
exiftool -csv=Caption_Neu.csv "C:\AA"

Gives for all files in directory C:\AA:
...
No SourceFile 'C:/AA/bw_kf200003.jpg' in imported CSV database
No SourceFile 'C:/AA/bw_kf200220.jpg' in imported CSV database
    1 directories scanned
    0 image files read

I'm using the Windows version and put the script in the prompt window. Its a miracle.

Greetings Bette
Title: Re: Import from csv file...
Post by: Phil Harvey on September 20, 2011, 07:35:52 AM
Hi Bette,

Quote from: pixelpicker on September 20, 2011, 07:10:55 AM
exiftool -csv=Caption_Neu.csv "C:\AA"

But you wrote your CSV file to the C:\AA directory, so shouldn't your command be?:

exiftool -csv=C:\AA\Caption_Neu.csv C:\AA

It looks like you have another CSV file in the current directory which is different than the one you created.

- Phil
Title: Re: Import from csv file...
Post by: pixelpicker on September 20, 2011, 09:07:25 AM
Dear Phil,

That was it!!!!!! Thank you!!!!!
The path has to be defined for both: csv file and images.

But kow I have another problem. Since I used the -L option to create the csv file, Exiftool gives me a warning:

Warning: Malformed UTF-8 Character(s) - dir.image

All Captions are cut, where an Umlaut (ä ö ü) is in the text.

I tried: -codedcharacterset=utf8, but it didn't work.

How can I convert to UTF-8 while reading from the csv file?

Greetings Bette
Title: Re: Import from csv file...
Post by: Phil Harvey on September 20, 2011, 09:11:46 AM
Did you try using the -L option when reading the CSV file too?

- Phil
Title: Re: Import from csv file...
Post by: pixelpicker on September 20, 2011, 11:13:31 AM
I didn't - but since NOW I will do :) - You're right - it works like this.
Thank you very much, Phil and have a nice day.

Greetings from Germany
Bette
Title: Re: Import from csv file...
Post by: tpcdce on April 23, 2013, 08:06:31 PM
Hello Phil,

I found this thread because I am having similar issues with my csv. I get the same error that Bette originally got. I have gone through my files and my csv and it appears that neither contain any non-ASCII characters.

What should I do?

Thank you,
Julian
Title: Re: Import from csv file...
Post by: Phil Harvey on April 24, 2013, 07:33:13 AM
You got the "no SourceFile" error?

Try running "exiftool FILE", where FILE is the name of the problem file.  If the file exists (and the directory and/or file name don't contain special characters) then you should be able to extract the information like this.  If it doesn't work, the file name is wrong somehow and it will take some experimenting on your part to figure out why.  If it does work, then maybe it is possible that there are hidden characters in the SourceFile?  (like spaces at the end maybe?)

If you use ExifTool to generate the CSV file, then the SourceFile will be correct.  Did you try this?

- Phil
Title: Re: Import from csv file...
Post by: tpcdce on April 30, 2013, 08:12:21 PM
Dear Phil,

Thank you for the help.

It appears that my issue was that the spaces in the file path were throwing exiftool off. I fixed this with quotation marks, but I am now getting a new error.

When I run exiftool -csv=TPCDCE1.csv -r "H:\Image Library"
I get this error:
"H:\Image Library\Locke 11.JPG": No such file or directory exists at script/exiftool line 1454

What does this mean?

Thank you for the help.

Best,
Julian
Title: Re: Import from csv file...
Post by: tpcdce on April 30, 2013, 08:14:31 PM
Also, I checked, and the file "H:\Image Library\Locke 11.JPG" exists. It is also recognized by exiftool when I run exiftool FILENAME.
Title: Re: Import from csv file...
Post by: Phil Harvey on May 01, 2013, 07:49:20 AM
Hi Julian,

What version of exiftool are you using?  I would like to look up the line number but it doesn't match with the current version.

- Phil
Title: Re: Import from csv file...
Post by: tpcdce on May 07, 2013, 07:29:42 PM
Phil,

I am using 9.2.4.0
I will download the latest version and tell you if I get the same issue

-Julian
Title: Re: Import from csv file...
Post by: tpcdce on May 07, 2013, 07:42:29 PM
Ok, using the new exiftool (9.28), here is what I get:

I run: exiftool.exe -csv=TPCDCE1.csv -r "H:\Image Library"
I get back: "H:\Image Library\Locke 11.JPG": No such file or directory at script/exiftool line 1479
Title: Re: Import from csv file...
Post by: Phil Harvey on May 08, 2013, 08:38:56 PM
I don't understand the line number, but what does this command give?:

exiftool "H:\Image Library\Locke 11.JPG"

- Phil
Title: Re: Import from csv file...
Post by: tpcdce on May 20, 2013, 08:35:50 PM
It returns the info that exiftool returns when I run it on any other image file.

After removing the Locke 11.jpg file from the csv, it went through and I thought that it had worked. I went and checked the files, but none of them appeared to be altered.

I reran the command and got multiple errors.

I then reran ran with out the -r part of the command and got another no such file or directory error, but this time with the line being 1479. I tried removing problem files like I did earlier, but every time there would be another file that had an error.

Do you have any ideas?

-Julian
Title: Re: Import from csv file...
Post by: Phil Harvey on May 21, 2013, 07:12:27 AM
Hi Julian,

I'm wondering if the problem could be caused by a virus scanner locking the files?  If the problem is intermittent, I can only think of either this or a disk problem being the reason.

- Phil
Title: Re: Import from csv file...
Post by: tpcdce on May 22, 2013, 09:13:03 PM
Phil-

I am not sure what I did, but I got it to work. Thank you so much for the help

-Julian
Title: Re: Import from csv file...
Post by: tpcdce on May 28, 2013, 07:36:11 PM
Phil -

Although I thought it had worked, upon further investigation, it appears that only a few of the keywords I wished to add to the files were added, and the ones that were added are only recognized by exiftool. This means that if I open the properties tab of the image, there are no values there.

Just to double check that I am not crazy, exiftool can be used to batch write keywords on photos.

Sorry for the inconvenience.

Best,
Julian
Title: Re: Import from csv file...
Post by: Phil Harvey on May 29, 2013, 07:26:12 AM
Hi Julian,

Reading FAQ number 3 (https://exiftool.org/faq.html#Q3) may help here.

And about the keywords you say weren't added:  Break the command down to a single file and use the -v3 option to see what is happening when you write them.

- Phil