News:

2023-08-10 - ExifTool version 12.65 released

Main Menu

Sync GPS from txt files

Started by Newsky, August 26, 2015, 04:26:12 AM

Previous topic - Next topic

Newsky

I have two text files in which lists of files with full ways to them are specified. Ways and names of files the identical. In the first folder of the photo without GPS of data, and in the second with GPS this. How GPS can copy only data from files of the first list in files from the second list? Structure (the enclosed folders) are identical, differ only a disk name.
Sorry for my english. I use Google translator

Phil Harvey

Here is the usual way to do this (let's assume the images without GPS are on E: and the images with GPS are on F:)

1) cd E:

2) cd /

3) exiftool -tagsfromfile F:%d%f.%e -gps:all /FOLDER

where /FOLDER is the name of the folder containing the images, starting with a "/".

I can't test this right now on Windows, but I think this should work if I remember correctly how Windows handles working directories.

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

Newsky

The most important in a task that files which need to be processed it is necessary to take from without_gps.txt In both folders more than 33000 photos, and it is necessary to process about 6000 and I can't shift them in other folder because all of them lie in different places.
Without_gps.txt:
Quoted:\photo\Apple\Camera\2012\2012-11\2012-11-17 17-22-38.jpg
d:\photo\Apple\Camera\2012\2012-11\2012-11-18 13-32-21.jpg
d:\photo\Apple\Camera\2012\2012-11\2012-11-18 13-36-21.jpg
d:\photo\Apple\Camera\2012\2012-11\2012-11-21 13-47-35.jpg
d:\photo\Apple\Camera\2012\2012-11\2012-11-21 16-18-23.jpg
with_gps.txt:
QuoteE:\photo\Apple\Camera\2012\2012-11\2012-11-17 17-22-38.jpg
E:\photo\Apple\Camera\2012\2012-11\2012-11-18 13-32-21.jpg
E:\photo\Apple\Camera\2012\2012-11\2012-11-18 13-36-21.jpg
E:\photo\Apple\Camera\2012\2012-11\2012-11-21 13-47-35.jpg
E:\photo\Apple\Camera\2012\2012-11\2012-11-21 16-18-23.jpg
Sorry for my english. I use Google translator

Phil Harvey

I can't test this right now on Windows, but something like this may work:

exiftool -tagsfromfile e:%:1d%f.%e -gps:all -@ Without_gps.txt

But I'm not sure that %:1d will remove just the drive letter.  You'll have to test on Windows to see what happens.

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

Newsky

Quote from: Phil Harvey on August 26, 2015, 09:09:14 AM
exiftool -tagsfromfile e:%:1d%f.%e -gps:all -@ Without_gps.txt

This option worked perfectly! But ... the Cyrillic, Cyrillic ... :(
Process only those files that were not in the way the Cyrillic



Then I decided to try this option:
Quote1) cd E:

2) cd /

3) exiftool -tagsfromfile F:%d%f.%e -gps:all /FOLDER

Leaving only the necessary files, run the above code, and that something is not right ...

Sorry for my english. I use Google translator

Phil Harvey

Why is it looking for .psd and .tif files?  I thought the images were .jpg.

If WIthout_gps.txt contains special characters, then you must specify the character set.  Hopefully it is UTF-8, and if so this is the command:

exiftool -tagsfromfile e:%:1d%f.%e -gps:all -charset filename=utf8 -@ Without_gps.txt

Also, to display the filenames properly you must either change cmd.exe to UTF8, or specify the character set you are using, maybe like this:

exiftool -tagsfromfile e:%:1d%f.%e -gps:all -charset filename=utf8 -charset latin2 -@ Without_gps.txt

See FAQ 10 for more information.

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

Newsky

Yes, yes, just jpg files. I just had to put in a folder, all files without the GPS coordinates, otherwise there is no way, and to handle PSD, Tiff is not necessary.
Sorry for my english. I use Google translator

Phil Harvey

Then I don't understand why the .psd and .tif files were apparently inside WIthout_gps.txt

Anyway, you may want to add -ext jpg to your command to process only .jpg files.

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

Newsky

I think I understand why you are asking about :) PSD. In the log, visible only error with PSD, TIFF, but JPG exactly the same error "file not found" and it is clear why. At first, I found in the LR all photos without geotags, noted their "red", and then, in Total Commmander found all new and changed files are copied the full path of the selected files. So I got the list. There were-and PSD.
To deal with encoding, I read the FAQ on your link (certainly not in the first :) ). But I will add key -ext jpg
Sorry for my english. I use Google translator

Newsky

I do not cease to thank you, Phil! Everything went really well. Thanks for the help!
Quote1774 image files updated
4652 image files unchanged
-- press any key --
Sorry for my english. I use Google translator

Newsky

There was a similar question. How can process images (such as exiftool -Comment="This is a new comment") from a text list?
text_list.txt:
Quoted:\photo\Apple\Camera\2012\2012-11\2012-11-17 17-22-38.jpg
d:\photo\Apple\Camera\2012\2012-11\2012-11-18 13-32-21.jpg
d:\photo\Apple\Camera\2012\2012-11\2012-11-18 13-36-21.jpg
d:\photo\Apple\Camera\2012\2012-11\2012-11-21 13-47-35.jpg
d:\photo\Apple\Camera\2012\2012-11\2012-11-21 16-18-23.jpg
Sorry for my english. I use Google translator

Phil Harvey

exiftool -Comment="This is a new comment" -@ text_list.txt
...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 ($).

Newsky

Simple as that from ExifTool !!! Thank you!
Sorry for my english. I use Google translator

Newsky

Quote from: Phil Harvey on August 26, 2015, 09:09:14 AM
I can't test this right now on Windows, but something like this may work:

exiftool -tagsfromfile e:%:1d%f.%e -gps:all -@ Without_gps.txt

But I'm not sure that %:1d will remove just the drive letter.  You'll have to test on Windows to see what happens.

- Phil
I think again, I'm doing something wrong, but I can not understand that ... Again, please help ...
https://youtu.be/ZNkKjAvR-cg
Sorry for my english. I use Google translator

Phil Harvey

I just wanted you to know that I am not ignoring you.  I need to test this out on a Windows computer, and I haven't had a chance to do that yet.

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

Newsky

Thinking negatively about you (that you ignore for example) there is no reason. I'll wait as necessary. You always help, Phil. Thank!
Sorry for my english. I use Google translator

Phil Harvey

I just tried this out and it works fine for me on Windows.

I think you must be using an old version of exiftool.  Run "exiftool -ver" to check the version number.  The current version is 10.02.

This would explain why "%:1d" doesn't work (requires version 9.03 or later), and why you got the "unknown type for -charset option" warning (requires version 9.79 or later).

Also, I think you should use "e:\%:1d%f.%e", because "%:1d" seems to remove drive letter and first backslash:

exiftool -tagsfromfile e:\%:1d%f.%e -gps:all -@ Without_gps.txt

Or

exiftool -tagsfromfile e:/%:1d%f.%e -gps:all -@ Without_gps.txt

should also work.

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

Newsky

exiftool -tagsfromfile f:\%:1d%f.%e -gps:all -@ Without_gps.txt -m -k  and
exiftool -tagsfromfile f:/%:1d%f.%e -gps:all -@ Without_gps.txt -m -k
It works fine in version 9.7.8.0, 9.0.3.0

in versions 9.9.9.9-10.0.0.2: FileName encoding not specified
if you add -charset filename=utf8:
Invalid filename encoding for e:/photo/Поездки/2013-07-19-Европа/04-Великобритания/03-Stonehenge/2013-07-23 11-08-46.jpg
Error opening directory e:/photo/Поездки/2013-07-19-Европа/04-Великобритания/03-Stonehenge/2013-07-23 11-08-46.jpg


It turns out, in the current version and subsequent perform this operation would be impossible? (in the presence of Cyrillic characters in the file path)  :(

Now I was able to recover all the geo data, thank you very much! I know that this function is useful to me more than once and it is a pity that this problem will have to use an older version, rather than the actual use. I am very grateful for the help!
Sorry for my english. I use Google translator

Phil Harvey

Quote from: Newsky on September 22, 2015, 02:38:11 PM
in versions 9.9.9.9-10.0.0.2: FileName encoding not specified

The behaviour should be the same as previous versions other than the added warning.  Did you check to see if the same files were written as when using an older version?

If you specify a filename encoding then it must be the right one or it definitely won't work.  Apparently your txt file is not encoded in UTF8.

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

Newsky

Quote from: Phil Harvey on September 24, 2015, 05:09:26 PM
Apparently your txt file is not encoded in UTF8.

- Phil
I was very uncomfortable. This was also a problem. I have not checked the file encoding. Everything works great! Now I will not forget about coding! Thank you, Phil!
Sorry for my english. I use Google translator