Changing Tag content from csv: no such file or no SourceFile error

Started by alfric, March 12, 2021, 10:59:06 AM

Previous topic - Next topic

alfric

Hi,
I converted exported GPS data with an online tool to address (city, street etc) and wanted to import that via a csv file into comments or filename. However, I experienced basic errors in reading the csv. I spent many hours scanning the forum and trying to find, what is wrong, but no success (I must admit, that I am a bloody beginner). So, any help would be appreciated.

What I did: Exporting the path + tag into csv , +/- including a nw Tag value.
#To avoid any spelling/misplacing error, I produced a csv by:
exiftool -FileName -Caption-Abstract -csv ~/desktop/test1/ > out.txt
# and renamed it. It looks like this: (changing all to lower case does´nt have effect):
SourceFile,FileName,Caption-Abstract
/Users/alf 1/desktop/test1/IMG_5168.jpg,IMG_5168.jpg,Vor Ortsgründung
/Users/alf 1/desktop/test1/IMG_5172.jpg,IMG_5172.jpg,
/Users/alf 1/desktop/test1/IMG_4718.JPG,IMG_4718.JPG,
/Users/alf 1/desktop/test1/outin.txt,outin.txt,

#However, with this, writing the Tag value from csv is not done; no matter whether using a space before the path name or not, or whether using quotes around the path name:
exiftool -Caption/Abstract <=~/desktop/Test1/outin.csv
=~/desktop/Test1/outin.csv: No such file or directory.

#Also a versions with defining source and target folder is not working:
exiftool -csv="~/desktop/Test1/outin.csv" "~/desktop/Test1/Images"
Error opening CSV file '~/desktop/Test1/outin.csv'
No SourceFile '~/desktop/Test1/Images' in imported CSV database
#nor
exiftool -csv="~/desktop/Test1/outin.csv" "~/desktop/Test1"
Error opening CSV file '~/desktop/Test1/outin.csv'
No SourceFile '~/desktop/Test1' in imported CSV database
#nor
exiftool -csv="~/desktop/Test1/outin.csv" "~/desktop/Test2"
Error opening CSV file '~/desktop/Test1/outin.csv'
No SourceFile '~/desktop/Test2' in imported CSV database


#Curiously, the csv-file is recognized and the filename given as expected with a simple query:
exiftool -filename ~/desktop/Test1/outin.csv
File Name                       : outin.csv

#Same for the folder:
exiftool -filename -caption-Abstract ~/desktop/Test1/
======== /Users/alf 1/desktop/Test1/IMG_5168.jpg
File Name                       : IMG_5168.jpg
======== /Users/alf 1/desktop/Test1/outin.csv
File Name                       : outin.csv
======== /Users/alf 1/desktop/Test1/IMG_5172.jpg
File Name                       : IMG_5172.jpg
======== /Users/alf 1/desktop/Test1/IMG_4718.JPG
File Name                       : IMG_4718.JPG
    1 directories scanned
    4 image files read

So I have no idea what could be wrong...

Luuk2005

Greetings Alfric, Im not using the Linux, but did you ever try with the single-quotes like...
exiftool -csv='~/desktop/Test1/outin.csv' 'TargetPath'
Windows8.1-64bit, exiftool-v12.11(standalone), sed-v4.0.7

Phil Harvey

Interestingly, this seems to be entirely a Unix shell problem.  The tilde is expanded by the shell, so it can't be quoted.  Try this:

exiftool -csv=~/desktop/Test1/outin.csv ~/desktop/Test2

- Phil

Edit: Hmm.  That may not work either if the tilde doesn't come first in the argument.  Maybe you will have to do this:

exiftool -csv="/Users/alf 1//desktop/Test1/outin.csv" ~/desktop/Test2
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

alfric

Unfortunatly, doesn't work either.  With the first, "error opening csv" appears; with the second, no error message, but: " 1 directories scanned
    0 image files read"
??

Phil Harvey

OK.  Maybe just punt on the whole path idea, and "cd" into the directory with the images, and put the csv file in there too, then do this:

exiftool -csv=outin.csv .

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Luuk2005

This is really making me think to never try the unix, so just trying to invent some ideas...
Im thinking cd'ing into the folder like Phil Harvey is saying, it should be impossible to fail.

It seems like Unix should know to 'auto-quote' ~ if it has the spaces, so maybe using ~/"Path" ?
In Windows there is %HOMEPATH%, so maybe an equivalent "$Home..." to grant the expansion?
Also, maybe just typing the whole ".../.../Users/alf 1/" if nothing else works?
Windows8.1-64bit, exiftool-v12.11(standalone), sed-v4.0.7

alfric

Thanks to Phil! His proposal did the job. I only had to figure out that also the csv-file has to use the abbreviated format for the path. So I finally used successfully:
- setting the path with cd: cd ~/desktop/testfolder/
- reading/writing of a tag content (caption-abstract in my case) from a csv file "outin.csv": exiftool -csv=outin.csv where the csv looks like that:
SourceFile,FileName,Caption-Abstract
./outin.csv,outin.csv,
./IMG_5172.jpg,IMG_5172.jpg,comment
./IMG_4718.JPG,IMG_4718.JPG,comment2


To Luuk: may be it is the Unix, or inconsistencies between folder names used by the Mac system and used in the GUI ? Because the export of the path by a produced csv did not work when used as input path. In addition I suspected that a space in my home folders name could cause problems (although I also tried slashes and different quotes)... An effort to rename the home folder, along a how-to-do from apple support, however was not a good idea; it resulted in a fiasco, so that I had to go back to a backup copy of the whole system...
Anyway, the elegant workaround of Phil solved all problems!
If anybody is interested in the results: this is a documentation of historical buildings in our town where I mapped the Fotos to an OSM-map by using Umap and the Mejiro tool after correcting GPS positions and adding the address, queried externally, to the image name: http://u.osmfr.org/m/578781/