Author Topic: conditionnal renaming files (with no gps info)  (Read 202 times)

sevy

  • Jr. Member
  • **
  • Posts: 16
conditionnal renaming files (with no gps info)
« on: April 14, 2019, 11:21:10 AM »
Hello,

I know how to rename files according creation date, I learn how to find pictures with no gps info but how to rename pictures with no gps info ?
I'm trying to get this result : if the picture "filename.jpg" does not contain gps info, it should renamed as "filename_NOGPS.jpg"

I guess this operation should be possible with Exiftool but impossible to find the way.

thanks in advance for your help,

sevy

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 2516
Re: conditionnal renaming files (with no gps info)
« Reply #1 on: April 14, 2019, 11:36:41 AM »
Try
exiftool -if "not $GPSLatitude" "-FileName=%f_NOGPS.%e"

In this example, if there is no latitude data, it's quite unlikely that there is any other useful GPS data.  The GPSVersionID tag might exist, as a lot of cameras will embed that even when no other GPS data is added.

edit: Fixed error
« Last Edit: April 14, 2019, 02:21:15 PM by StarGeek »
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

sevy

  • Jr. Member
  • **
  • Posts: 16
Re: conditionnal renaming files (with no gps info)
« Reply #2 on: April 14, 2019, 01:51:20 PM »
hello,

Thanks for the quick reply !
I tried your suggestion with test-files but I got an error message :
Warning: No writable tags set from ./FILENAME.JPG
Warning: Invalid tag name '%f_nogps.%e' - ./FILENAME.JPG

Files with no gps have been correctly identified but not modified.

I forgot to write I'm working with Win10 and the last version of ExifTool (11.35)

Hayo Baan

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 1049
  • Professional Photographer & Software Developer
    • Hayo Baan – Photography
Re: conditionnal renaming files (with no gps info)
« Reply #3 on: April 14, 2019, 02:06:56 PM »
Change the < into an = and it should work.
Hayo Baan – Photography
Web: www.hayobaan.nl

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 2516
Re: conditionnal renaming files (with no gps info)
« Reply #4 on: April 14, 2019, 02:23:45 PM »
And there I go getting bitten by the < vs = difference again :D

Funny thing is I started off correctly, then started to do a different version using $FileName, then decided to revert to the simplest form and expand later if needed, but forgot to fix that part.
Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

Hayo Baan

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 1049
  • Professional Photographer & Software Developer
    • Hayo Baan – Photography
Re: conditionnal renaming files (with no gps info)
« Reply #5 on: April 14, 2019, 02:43:46 PM »
And there I go getting bitten by the < vs = difference again :D

Funny thing is I started off correctly, then started to do a different version using $FileName, then decided to revert to the simplest form and expand later if needed, but forgot to fix that part.

Ha yes, that one still bites me sometimes as well. It took me a while before I saw the problem. In fact I had to run the command myself to see what could have been wrong ;)
Hayo Baan – Photography
Web: www.hayobaan.nl

sevy

  • Jr. Member
  • **
  • Posts: 16
Re: conditionnal renaming files (with no gps info)
« Reply #6 on: April 14, 2019, 02:57:54 PM »
Hello,

thanks a lot  / hartelijk bedankt to StarGeek and Hayo : it's working perfectly !