Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How can I find all geotagged photos with Yosemite 10.10.5 FINDER

I am trying to find and BULK COPY all geotagged photos in the .NEF or .DNG format that are on my hard drive in a way that will RETAIN the geotagging data. Is there any way to do this? Apparently some copying has stripped out geotags on multiple copies of the same images. I have in excess of 56,000 images to sort through and do not want to use PREVIEW to check them and then copy them one at a time. Can you help???

iMac, OS X Yosemite (10.10.5)

Posted on Feb 24, 2018 3:56 PM

Reply
Question marked as Best reply

Posted on Feb 26, 2018 7:50 PM

Here is how to create an Applescript Application.


Here is the program:



(*

https://discussions.apple.com/thread/3033221?tstart=30

Required:


Turn on accessability GUI in system preferences.

Optional:
--------
Full Key Codes
http://www.versiontracker.com/dyn/moreinfo/macosx/21215


youpi or iKey
   youpi and iKey are keystroke remapping programs.
   youpi, the free version, works fairly well for me in Mac OS 10.4 although not officially supported.
http://www.versiontracker.com/dyn/moreinfo/macosx/11485&vid=75326
   iKey is the paid version
http://www.scriptsoftware.com/ikey/

*)

on run
    -- Write a message into the event log.
    -- To see, run this applescript in Sript Editor. Click on Event Log tab at bottom of screen.
    -- Click run.
    log "  --- Starting on " & ((current date) as string) & " --- "

    set fromApp to "Safari"
    set toApp to "TextEdit"

    --- We have arrived.


    say "we are beginning now."

    -- Start your application
    tell application fromApp
        activate
    end tell

    delay 1

    say "copy data to clipboard"

    tell application "System Events"
        tell process fromApp


            keystroke "c" using command down
            delay 2

        end tell
    end tell


    -- Start your application
    tell application toApp
        activate
    end tell

    delay 5
    tell application "System Events"
        tell process fromApp
            --  open file menu
            keystroke return
            keystroke return
            keystroke return

            keystroke "v" using command down

        end tell
    end tell

    say "good news, We are done."

end run


The first thing that you need to do is to make the text into an AppleScript program.


Start the AppleScript Editor

/Applications/AppleScript/Script Editor.app

In Snow Leopard it's at: /Applications/Utilities/AppleScript Editor


Copy the script text to the Applescript editor.


Save the text to a file as an application and do not check any of the boxes below.



User uploaded file


If you want access to the script from your Script Menu, move the script (the saved script application file) to your

~/Library/Scripts folder. You can also drag it to your Dock or make an alias for it on the Desktop.<br><br>


To debug, run the script within the Applescript Editor. Click on the event log tab at the bottom of the window. Click on the run icon. The results from the log statement will be shown at the bottom of the screen.



User uploaded file

Similar questions

11 replies
Question marked as Best reply

Feb 26, 2018 7:50 PM in response to rccharles

Here is how to create an Applescript Application.


Here is the program:



(*

https://discussions.apple.com/thread/3033221?tstart=30

Required:


Turn on accessability GUI in system preferences.

Optional:
--------
Full Key Codes
http://www.versiontracker.com/dyn/moreinfo/macosx/21215


youpi or iKey
   youpi and iKey are keystroke remapping programs.
   youpi, the free version, works fairly well for me in Mac OS 10.4 although not officially supported.
http://www.versiontracker.com/dyn/moreinfo/macosx/11485&vid=75326
   iKey is the paid version
http://www.scriptsoftware.com/ikey/

*)

on run
    -- Write a message into the event log.
    -- To see, run this applescript in Sript Editor. Click on Event Log tab at bottom of screen.
    -- Click run.
    log "  --- Starting on " & ((current date) as string) & " --- "

    set fromApp to "Safari"
    set toApp to "TextEdit"

    --- We have arrived.


    say "we are beginning now."

    -- Start your application
    tell application fromApp
        activate
    end tell

    delay 1

    say "copy data to clipboard"

    tell application "System Events"
        tell process fromApp


            keystroke "c" using command down
            delay 2

        end tell
    end tell


    -- Start your application
    tell application toApp
        activate
    end tell

    delay 5
    tell application "System Events"
        tell process fromApp
            --  open file menu
            keystroke return
            keystroke return
            keystroke return

            keystroke "v" using command down

        end tell
    end tell

    say "good news, We are done."

end run


The first thing that you need to do is to make the text into an AppleScript program.


Start the AppleScript Editor

/Applications/AppleScript/Script Editor.app

In Snow Leopard it's at: /Applications/Utilities/AppleScript Editor


Copy the script text to the Applescript editor.


Save the text to a file as an application and do not check any of the boxes below.



User uploaded file


If you want access to the script from your Script Menu, move the script (the saved script application file) to your

~/Library/Scripts folder. You can also drag it to your Dock or make an alias for it on the Desktop.<br><br>


To debug, run the script within the Applescript Editor. Click on the event log tab at the bottom of the window. Click on the run icon. The results from the log statement will be shown at the bottom of the screen.



User uploaded file

Feb 27, 2018 9:23 AM in response to rccharles

When GPS data is present in an image, the mdls command will introduce kMDItemGPSDateStamp (EXIF DateStamp), kMDItemLatitude (EXIF Latitude), and kMDItemLongitude (EXIF Longitude) keyword data in the output. If one filters the output through grep looking for a match one can determine by the returned 1 count if there is GPS data in the image. There is also a kMDItemTimestamp that corresponds to the EXIF GPS TimeStamp.


The above keywords have data represented by "2018:02:27", unquoted latitude, and unquoted longitude numerical values. The following grep filter will match all of these, so the mdls keyword is simply interchangeable:


mdls -name kMDItemGPSDateStamp IMG_0225.DSC | grep -c '[0-9:.-]+'


I added the '-' character in the match to accommodate a camera writing the GPS date stamp in ISO format (e.g. 2018-02-27).

Mar 17, 2018 2:39 PM in response to jr2001

What you want to do is to examine a .nef or a .dng file and see if it is geotagged, and if it's geotagged you want to copy it. I do not believe that the finder has any geotagging type knowledge. You will have to find some app that does what you want or find a terminal command that has the ability to make this determination then do the copy.


R

Mar 17, 2018 2:40 PM in response to jr2001

I have done some testing, but you should to more. Restrictions:


-- The output folder may not have blank characters anywhere in the folder names.

-- you need to use the mouse button to click on the choose button.

-- you must install exiftool here: /usr/local/bin


I'll look more into these situations when I get a chance.


(*
   Copy photo files with GPS information from source folder to destination folder.

   Requires installation of exiftool.
   http://owl.phy.queensu.ca/~phil/exiftool/index.html
  
   exiftool documentation
   https://www.sno.phy.queensu.ca/~phil/exiftool/

   author: rccharles
  
*)

tell application "Finder"
    -- Write a message into the event log.
    log "  --- Starting on " & ((current date) as string) & " --- "
   
    set theInputFolder to folder (choose folder with prompt "Folder you wish to copy the .dng and .nef files")
    --set theInputFolder to "Macintosh HD:Users:mac:exifin:" as alias
    log "theInputFolder = " & theInputFolder
   
    set theOutputFolder to folder (choose folder with prompt "Folder to place the  .dng and .nef files")
    --set theOutputFolder to "Macintosh HD:Users:mac:exifout:" as alias
    log "theOutputFolder = " & theOutputFolder
   
    -- ------------------------------------------------------------------------
   
    set inString to theInputFolder as string
    log "inString = " & inString
   
    set unixInputFolder to POSIX path of inString
    log "unixInputFolder = " & unixInputFolder
   
    set quotedUnixInputFolder to quoted form of unixInputFolder
    log "quoted form is " & quotedUnixInputFolder
   
    set outString to theOutputFolder as string
    log "outString = " & outString
   
    set unixOutputFolder to POSIX path of outString
    log "unixOutputFolder = " & unixOutputFolder
   
    set quotedUnixOutputFolder to quoted form of unixOutputFolder
    log "quoted form is " & quotedUnixOutputFolder
   
    log "lenght is " & length of quotedUnixOutputFolder
    set theLength to (length of quotedUnixOutputFolder) - 1
    log "lenght is " & theLength
    set partialString to text 2 thru theLength of quotedUnixOutputFolder
    log "partialString is " & partialString
   
    set escapedPartial to "" & partialString & ""
    log "escapedPartial is " & escapedPartial
   
   
    set seeUnix to do shell script "find " & quotedUnixInputFolder & " \\( -iname \"*.nef\" -o -iname \"*.dng\"  \\) -type f "
    log "looking here:" & return & seeUnix
   
    try
        set seeUnix to do shell script "which /usr/local/bin/exiftool "
       
        log "Found exiftool here: " & return & seeUnix
    on error errMsg
        log "could not find exiftool. Error message was " & errMsg
        return 1
    end try
    -- Some examples:
    -- find -x ~  \( -iname "*.jpeg" -o -iname "*.png"  \) -type f  -exec ls -l  {} \;
    -- " -iname \"*.xml\" -type f -maxdepth 1 -exec cp {} " & quotedUnixOutputFolder & " \\;"
    -- .NEF or .DNG
    -- find '/Users/mac/exifin/' \( -iname "*.nef" -o -iname "*.dng"  \) -type f  -exec sh -c "ls -l  {} && echo hi" \;
    -- exiftool -GPSLatitude -GPSLongitude
   
    set seeUnix to do shell script "find " & quotedUnixInputFolder & " \\( -iname \"*.nef\" -o -iname \"*.dng\"  \\) -type f "
    log "looking here:" & return & seeUnix
   
    -- kungfu setup.
    --    you only get all these backslashes by lots of debugin.
    set toUnix to "find " & quotedUnixInputFolder & " \\( -iname \"*.nef\" -o -iname \"*.dng\"  \\) -type f  "
    set toUnix to toUnix & " -exec sh -c 'ls -l \"{}\" "
    set toUnix to toUnix & "&& /usr/local/bin/exiftool -GPSLatitude -GPSLongitude \"{}\" | wc -w  | [ $(cat) -gt 0 ] "
    set toUnix to toUnix & "&& echo copy  && cp \"{}\" " & escapedPartial & " && echo  \"   Delivered\"'  \\;"
    --&& cp \"{}\ "  & quotedUnixOutputFolder & " && echo  \"   Delivered\"
    log "toUnix is " & toUnix
   
    try
        -- deliver the kunfu
        set fromUnix to do shell script toUnix
        log fromUnix
    on error errMsg
        log "find or copy error..." & errMsg
    end try
   
   
end tell

-- ---------------------------------------------------------------
-- bounus code
on alterString(thisText, delim, replacement)
    set resultList to {}
    set {tid, my text item delimiters} to {my text item delimiters, delim}
    try
        set resultList to every text item of thisText
        set text item delimiters to replacement
        set resultString to resultList as string
        set my text item delimiters to tid
    on error
        set my text item delimiters to tid
    end try
    return resultString
end alterString

Feb 27, 2018 9:55 AM in response to VikingOSX

When GPS data is present in an image, the mdls command will introduce kMDItemGPSDateStamp (EXIF DateStamp), kMDItemLatitude (EXIF Latitude), and kMDItemLongitude (EXIF Longitude) keyword data in the output.


Only if you have spotlight turned on for the folder where the picture is. At least, I get an error message on pictures. I've turned off spotlight.


R

How can I find all geotagged photos with Yosemite 10.10.5 FINDER

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.