Skip to content

Instantly share code, notes, and snippets.

@akhenakh
Last active March 26, 2017 15:05
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 akhenakh/9593117 to your computer and use it in GitHub Desktop.
Save akhenakh/9593117 to your computer and use it in GitHub Desktop.
Screenshot, upload and share from your Google drive
#!/bin/bash
# 1st Install https://github.com/prasmussen/gdrive
# then use this script in Alfred or from CLI when you want to screenshot then upload to your gdrive
# then share the link to others from your paste board
# (run gdrive one first time to authenticate with Google)
screencapture -tjpg -i /tmp/temp_shot_gdrive.jpg
DATEFILENAME=`date +"%Y%m%d%H%M"`
# use -p id to upload to a specific folder
ID=`gdrive upload -f /tmp/temp_shot_gdrive.jpg -t screenshot${DATEFILENAME} --share | egrep "^Id:" | awk '{print $2}'`
echo https://drive.google.com/uc?id=${ID} | pbcopy
@Beomi
Copy link

Beomi commented Mar 26, 2017

#!/bin/bash

# 1st Install https://github.com/prasmussen/gdrive
# then use this script in Alfred or from CLI when you want to screenshot then upload to your gdrive 
# then share the link to others from your paste board
# (run gdrive one first time to authenticate with Google)

screencapture -tpng -i /tmp/temp_shot_gdrive.png
DATEFILENAME=`date +"%Y%m%d%H%M"`
# use -p id to upload to a specific folder
ID=`gdrive upload /tmp/temp_shot_gdrive.png  --name screenshot/screenshot${DATEFILENAME}.png --share | egrep "^Uploaded" | awk '{print $2}'`
echo "https://drive.google.com/uc?id=${ID}" | pbcopy

Update with gdrive 2.1!

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