Import from csv file...

Started by pixelpicker, September 16, 2011, 04:05:26 PM

Previous topic - Next topic

pixelpicker

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


Phil Harvey

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

pixelpicker

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

Phil Harvey

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

pixelpicker

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

Phil Harvey

Did you try using the -L option when reading the CSV file too?

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

pixelpicker

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

tpcdce

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

Phil Harvey

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

tpcdce

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

tpcdce

Also, I checked, and the file "H:\Image Library\Locke 11.JPG" exists. It is also recognized by exiftool when I run exiftool FILENAME.

Phil Harvey

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

tpcdce

Phil,

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

-Julian

tpcdce

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

Phil Harvey

I don't understand the line number, but what does this command give?:

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

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