Skip to content

Instantly share code, notes, and snippets.

@exogen
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save exogen/9817479 to your computer and use it in GitHub Desktop.
Save exogen/9817479 to your computer and use it in GitHub Desktop.
#!/bin/bash -e
# Google Drive file selector by Brian Beck.
# Latest version: https://gist.github.com/exogen/9817479
command -v selecta >/dev/null 2>&1 || {
echo >&2 "This utility requires selecta to be installed:"
echo >&2
echo >&2 " https://github.com/garybernhardt/selecta"
echo >&2
echo >&2 "If you use Homebrew, type:"
echo >&2
echo >&2 " brew install selecta"
echo >&2
exit 1
}
FINDCMD="find ~/Google\ Drive"
for search in "$@"
do
FINDCMD="$FINDCMD -iwholename \"*${search}*\""
done
FINDCMD="$FINDCMD -not -name .DS_Store -not -name Icon?"
SELECTION=$(eval "$FINDCMD" | selecta)
if [ -n "$SELECTION" ]
then
open "$SELECTION"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment