Geotag file with wildcard can't be opened

Started by Ovec, December 30, 2020, 04:47:07 PM

Previous topic - Next topic

Ovec

Hello! I'm trying to create simple command for Windows Explorer context menu to geotag JPG files in a directory using KML files in the same directory. And I'm getting "Error opening GPS file..." messages.

In principle, the file tree would look like this:

e.g.:
C:\test
  geo1.kml
  geo2.kml
  photo1.jpg
  .
  .
  photoX.jpg


In the demonstration below I isolated just one KML and one JPG file.

The command I came up with is following:

set jpgdir="C:\test"
exiftool -charset FileName=latin2 -overwrite_original -m -if "not ($GPSLatitude or $GPSLongitude)" -geotag "%jpgdir%\*.kml" "-geotime<${createdate}+01:00" "%jpgdir%\*.jpg"

This works perfectly:
    1 image files updated


Now the problem starts when the files are in a directory with non-english characters in its path. I found that the -charset option should be used for similar situations but it won't help me in this particular case for some reason:
Since non-english characters ěščřžýáíé are in the upper line of my keyboard, let's name the copy of the original folder like that and try:
set jpgdir="C:\ěščřžýáíé"
exiftool -charset FileName=latin2 -overwrite_original -m -if "not ($GPSLatitude or $GPSLongitude)" -geotag "%jpgdir%\*.kml" "-geotime<${createdate}+01:00" "%jpgdir%\*.jpg"

results in
Warning: Error opening GPS file 'C:/─Ť┼í─Ź┼Ö┼ż├Ż├í├ş├ę/geo1.kml' in File:Geotag (ValueConvInv)
Warning: No writable tags set from C:/─Ť┼í─Ź┼Ö┼ż├Ż├í├ş├ę/photo1.jpg
    0 image files updated
    1 image files unchanged



Now to my surprise, if I remove the wildcard from -geotag option, it works once again. It seems like the -charset option works for every other file path except for geotag with wildcard...?
set jpgdir="C:\ěščřžýáíé"
exiftool -charset FileName=latin2 -overwrite_original -m -if "not ($GPSLatitude or $GPSLongitude)" -geotag "%jpgdir%\geo1.kml" "-geotime<${createdate}+01:00" "%jpgdir%\*.jpg"

    1 image files updated

My system is Windows 10 (v2004), it (AFAIK) uses Windows-1250/Latin2 code page (Czech locale).
The Exiftool is freshly downloaded v12.13.

Did I do something wrong when I was cobbling together pieces of commands from the Google or is that actually a bug? :-)

StarGeek

Quote from: Ovec on December 30, 2020, 04:47:07 PM
Did I do something wrong when I was cobbling together pieces of commands from the Google or is that actually a bug? :-)

While I didn't read over the post too closely, it's mostly likely the bug that is the Windows Command line itself.  It's absolute garbage when it comes to non-ASCII characters.  You can try the options in FAQ #18 (maybe also FAQ #10) but they never worked for me.

But since you mentioned you're on Windows 10, you might take a look at this StackOverflow answer.  It's the only thing that ever worked for me.  You might get some minor weirdness elsewhere.  For example, my clipboard history program sometimes displays incorrect characters but that doesn't affect the actual output.
"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

Ovec

Quote from: StarGeek on December 30, 2020, 06:36:25 PMit's mostly likely the bug that is the Windows Command line itself
Why does wildcard work correctly for image files but not for -geotag option then?

Quote from: StarGeek on December 30, 2020, 06:36:25 PMyou might take a look at this StackOverflow answer.
Thanks, enabling system wide UTF-8 support and using -charset filename=utf8 option solved my issue.