Last active
August 29, 2015 14:23
-
-
Save dmitryd/ceb93c68d25bb95bc451 to your computer and use it in GitHub Desktop.
Change source URL of the file in the OS X metadata from shell
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
#/bin/bash | |
if [ ! -e "$2" ] ; then | |
echo "Format: `basename $0` url file" | |
echo "" | |
echo "Sets the source URL of the file." | |
echo "" | |
exit 1 | |
fi | |
URL="$1" | |
ENCODED_URL=`echo \(\'$URL\'\) | plutil -convert binary1 -o - - | xxd -p -c 16 -u` | |
xattr -xw com.apple.metadata:kMDItemWhereFroms "$ENCODED_URL" "$2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment