Created
July 3, 2014 05:22
-
-
Save xiconet/3296b8eb03ff1b3ae79a to your computer and use it in GitHub Desktop.
gdsort: sort the output of gdrive list
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/sh | |
# sort the output of gdrive list | |
# takes a folder_id as argument, returns a sorted list of items in the corresponding folder | |
# TODO: sort by item title while keeping the id in the output | |
# | |
if [ $# = 0 ]; then | |
echo -e "you must provide a folder_id\nType -h or --help for details" | |
exit 0 | |
fi | |
if [ $1 = "-h" ] || [ $1 = "--help" ] | |
then | |
echo -e "`basename $0` takes a folder_id and returns a sorted list \nfrom the output of \"gdrive list -q <folder_id>.\"\nUse \"root\" as an alias for the root's folder_id" | |
exit 0 | |
fi | |
folder_id=$1 | |
gdrive.exe list -n -q "'$folder_id' in parents" | sed -r 's/0B_.{26}//g' | sort |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A little shell wrapper script around the excellent golang
gdrive
Google drive command-line client. A future (better) version would have the option to keep the Id column in the output. Also, it would be nice to have untruncated titles, but this depends ongdrive
itself.