Skip to content

Instantly share code, notes, and snippets.

@derickfay
Last active April 29, 2018 23:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derickfay/5efeccab7d290252848ff6e84440c0be to your computer and use it in GitHub Desktop.
Save derickfay/5efeccab7d290252848ff6e84440c0be to your computer and use it in GitHub Desktop.
Search for files with a given tag in the current working directory only
if [ "$#" -ne 1 ]
then
echo "Usage: lstag <tag>"
exit 1
fi
mdfind "kMDItemUserTags == '*$1*'" -onlyin . | sort --ignore-case | grep $PWD | grep -v ^$PWD/.*/.*$ | sed 's!.*/!!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment