Skip to content

Instantly share code, notes, and snippets.

@scottstanfield
Forked from code2k/convertOM2OSXTags.sh
Created May 2, 2016 03:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save scottstanfield/683fcf4a16ed39ff4e0711be05e5d77a to your computer and use it in GitHub Desktop.
Save scottstanfield/683fcf4a16ed39ff4e0711be05e5d77a to your computer and use it in GitHub Desktop.
This script converts OpenMeta to OS X Mavericks tags.
#!/bin/bash
#
# This script converts OpenMeta to OS X Mavericks tags.
#
# http://code2k.net
#
# Copyright © 2013 CODE2K:LABS. All Rights Reserved.
mdfind "kMDItemOMUserTags == *" -onlyin "." | while IFS= read -r file; do
echo "$file"
plistTags=$(mdls -plist - -name kMDItemOMUserTags "$file"|grep -v "kMDItemOMUserTags\|dict")
xattr -w com.apple.metadata:_kMDItemUserTags "$plistTags" "$file"
done
@scottstanfield
Copy link
Author

scottstanfield commented May 2, 2016

Added the -onlyin flag, so to limit the command to the current folder for performance reasons.

@scottstanfield
Copy link
Author

If you came here via Google: I used this to copy my nvAlt notes (tagged with OpenMeta) to a format searchable / suitable by OS X Finder. Tested with OS X El Capitan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment