Created
May 13, 2017 10:12
-
-
Save cmittendorf/b92bc84a9fd73013423aebe34502dcf1 to your computer and use it in GitHub Desktop.
Copies the location information on macOS from one file to another.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [ $# != 2 ]; then | |
echo `basename $0`" <src file> <dst file>" | |
exit | |
fi | |
xattr -w "com.apple.metadata:kMDItemLatitude" $(mdls -name kMDItemLatitude "$1" | awk '{print $3}' | sed s/\"//g) "$2" | |
xattr -w "com.apple.metadata:kMDItemLongitude" $(mdls -name kMDItemLongitude "$1" | awk '{print $3}' | sed s/\"//g) "$2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I look at the kMDItemLatitude & kMDItemLongitude attributes of an image file taken from my iPhone with GPS data, latitude & longitude are floating point data type. This copyLocationFromFile.sh script writes them as strings and consequently such files don't show in spotlight searches (example: Latitude is greater/less than 0). I'm still looking for a way to write them as floats with xattr.