I have a rather clumsy and inefficient way to do this with exiftool, find, etc., but maybe there's a better way …

I have more than 24 thousand images, from several different devices.  I'd like to make lists of those that have GPS tags and those that don't.  Or one list with each identified as having or not.  And either at the same time or in a separate job, to reverse geocode a description of the location in an exif comment for those that have GPS.

Apple's Photos app sorts them by location but it keeps that info separate from the photo.  (And it currently crashes my laptop when I try to open the app)

LibreOffice Calc can handle more than 24K rows but I've seen its performance go to crap with large amounts of data. same for TextEdit. So I'll likely run the thing non-recursive in each directory. My "clumsy method" would take advantage of the fact that exiftool will leave the GPSDateTime field blank when no GPS data. I didn't know about the -if option—I'll have to look into that.

It was clumsy because I thought I would have to run each file to a temp file of tags, check for GPS in the temp file, and then do something with the image file based on that. So that is alleviated by the ability to put multiple files in one CSV list. But then I have further actions to take with the list, and that's daunting with more than three thousand directories.

  • \$\begingroup\$ Do you have space, ,,tab,newline character in your filenames? Do you have only JPG,PNG,TIFF or you have also RAW files. Do you use for RAW files XMP side file? \$\endgroup\$ Aug 21, 2022 at 6:38
  • \$\begingroup\$ There are a few raw files, but I don't know how I got them or anything about them. I'll probably convert them to .jpg before continuing this project. Most of the files are .jpg taken by iPhone, iPad, Microsoft Surface, and various digital cameras. \$\endgroup\$
    – WGroleau
    Aug 21, 2022 at 19:04
  • \$\begingroup\$ Do you have any symbols like space, ,, ; in the filenames? \$\endgroup\$ Aug 21, 2022 at 19:06
  • \$\begingroup\$ Also do you have diversity in extensions like JPG, JPEG, Jpg, etc? \$\endgroup\$ Aug 21, 2022 at 19:09
  • 1
    \$\begingroup\$ Some of the directory names have spaces, generated by an export from Photos.app. There are >95% .jpg, .JPG, .jpeg. but some .gif and .png \$\endgroup\$
    – WGroleau
    Aug 21, 2022 at 19:14

5 Answers 5


Using exiftool, to get a simple list of all files that include a GPS coordinate, you could do this
exiftool -if "$GPSLatitude" -p "$FilePath" /path/to/files/

To get a Y/N in front is a bit more complex, because by default, exiftool won't print anything for missing tags. To work around this, the -f (-ForcePrint) option is used with -api MissingTagValue option to set the default to 'N'. Exiftool's Advanced formatting feature is used to print a 'Y' if the tag exists. The -srcfile option is used to read and prioritize XMP sidecars if they exist. The -ext (-extension) option is used to exclude XMP files, as it can be assumed they are sidecars
exiftool -srcfile %d%f.xmp -srcfile @ --ext XMP -f -api "MissingTagValue=N" -p "${GPSLatitude;$_='Y'} $FilePath" /path/to/files/

You might also look at exiftool's -csv option and get CSV file which you could then load into Excel/LibreOffice and see all the values directly. Also included is the -n (--printConv) option to output in decimal format rather than Degrees/Minutes/Seconds
exiftool -csv -n -GPSLatitude -GPSLongitude /path/to/files/ >out.csv

Replace /path/to/files/ with the actual path to the files you want to process. Add -r to recurse into subdirectories. If this command is run under Unix/Mac/Powershell, reverse any double/single quotes to avoid variable interpretation.

  • \$\begingroup\$ What about RAW with GPS info in XMP? \$\endgroup\$ Aug 21, 2022 at 15:42
  • \$\begingroup\$ Also you will print files which are not images \$\endgroup\$ Aug 21, 2022 at 15:45
  • \$\begingroup\$ All of these commands will read either EXIF or XMP data if it's embedded in the file, as it will output exiftool's Composite GPS tags. If there are XMP sidecars, it will read those and output the results from that file. The only problem would be dealing with a Y for the XMP files and a N for the matching RAW files. You might use the [url=exiftool.org/… ([tt]-extension[/tt]) option[/url] to ignore the RAW files e.g. --ext CR2. That would output only the matching xmp. \$\endgroup\$
    – StarGeek
    Aug 21, 2022 at 15:48
  • \$\begingroup\$ How many extensions of RAW files you should ignore? And the OP will see in list file with XMP extension, not image file. \$\endgroup\$ Aug 21, 2022 at 15:50
  • \$\begingroup\$ It will list all files that exiftool can read. This would included filetypes other than images that will not have GPS coordinates, such as .docx or .txt. The [url=exiftool.org/… ([tt]-extension[/tt]) option[/url] can be used to limit or exclude unwanted filetypes. \$\endgroup\$
    – StarGeek
    Aug 21, 2022 at 15:50

There are scripts in various languages, such as Python, or Windows PowerShell to extract latitude and longitude EXIF data. Sort output on value, so null will be grouped together.


Jhead is a command line program reads & alters EXIF data. Jhead is available for Windows and Linux. A batch file can extract GPS information.

A simple example of a Windows batch script using grep (Unix utility ported to Windows):

@echo off
for %%x in ("*.jpg") do (
echo %%x
jhead %%x | grep "GPS L"
echo, )

Sample output from the script:


GPS Latitude : N 40d  8m 33.70s
GPS Longitude: W 117d 52m 10.59s

In the example, IMG01 doesn't have any GPS tags, IMG02 has a GPS tag.

Google's Geocoding API looks like it can give you location information based on Lat/Long (You'll need to explore this).


What I did was simpler than what I first had in mind, but still not ideal:

find Sort_By_Date -type d -print | while read DIR; do                                                           
  exiftool -csv -FileName -GPSDateTime -GPSPosition -GPSAltitude "$DIR" > "$DIR/exif-list.csv"

I suggest IMatch (photools.com). It is a Digital Asset Management program that is incredibly powerful. I think the $150 one-time cost is well worth it.

Anyway, you could simply create a filter that showed all images in its database that did not have GPS data. It also has a very useful tool to help you assign GPS data to images by just clicking on a map.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.