ExifTool Forum

ExifTool => Newbies => Topic started by: Newsky on August 26, 2015, 04:26:12 AM

Title: Sync GPS from txt files
Post by: Newsky on August 26, 2015, 04:26:12 AM
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.
Title: Re: Sync GPS from txt files
Post by: Phil Harvey on August 26, 2015, 07:50:06 AM
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
Title: Re: Sync GPS from txt files
Post by: Newsky on August 26, 2015, 08:37:31 AM
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
Title: Re: Sync GPS from txt files
Post by: 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
Title: Re: Sync GPS from txt files
Post by: Newsky on August 26, 2015, 02:22:21 PM
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

(http://img.maryno.net/images/16fd5b4156932203f3e9b6bd261a0967/5ab25ad6a7fbb0f8b98146ec35e03946.png)

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 ...

(http://img.maryno.net/preview/289b4ede909b88896459dd0dcdb326fe/1a866a0c19a6e87c5b94122d47aa1738.gif) (http://img.maryno.net/images/289b4ede909b88896459dd0dcdb326fe/1a866a0c19a6e87c5b94122d47aa1738.png)
Title: Re: Sync GPS from txt files
Post by: Phil Harvey on August 26, 2015, 02:40:19 PM
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 (https://exiftool.org/faq.html#Q10) for more information.

- Phil
Title: Re: Sync GPS from txt files
Post by: Newsky on August 26, 2015, 03:18:01 PM
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.
Title: Re: Sync GPS from txt files
Post by: Phil Harvey on August 26, 2015, 03:22:59 PM
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
Title: Re: Sync GPS from txt files
Post by: Newsky on August 26, 2015, 03:41:54 PM
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
Title: Re: Sync GPS from txt files
Post by: Newsky on August 30, 2015, 01:47:19 PM
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 --
Title: Re: Sync GPS from txt files
Post by: Newsky on September 03, 2015, 05:09:59 PM
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
Title: Re: Sync GPS from txt files
Post by: Phil Harvey on September 04, 2015, 07:52:13 AM
exiftool -Comment="This is a new comment" -@ text_list.txt
Title: Re: Sync GPS from txt files
Post by: Newsky on September 06, 2015, 03:39:05 AM
Simple as that from ExifTool !!! Thank you!
Title: Re: Sync GPS from txt files
Post by: Newsky on September 20, 2015, 04:31:35 PM
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
Title: Re: Sync GPS from txt files
Post by: Phil Harvey on September 21, 2015, 04:51:25 PM
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
Title: Re: Sync GPS from txt files
Post by: Newsky on September 22, 2015, 12:10:17 AM
Thinking negatively about you (that you ignore for example) there is no reason. I'll wait as necessary. You always help, Phil. Thank!
Title: Re: Sync GPS from txt files
Post by: Phil Harvey on September 22, 2015, 12:11:26 PM
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
Title: Re: Sync GPS from txt files
Post by: Newsky on September 22, 2015, 02:38:11 PM
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!
Title: Re: Sync GPS from txt files
Post by: Phil Harvey on September 24, 2015, 05:09:26 PM
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
Title: Re: Sync GPS from txt files
Post by: Newsky on September 25, 2015, 12:57:04 AM
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!