Skip to content

Instantly share code, notes, and snippets.

@menasheh
Created February 26, 2018 01:13
Show Gist options
  • Save menasheh/e3fe6ed57a45333582a53539ccfecd1b to your computer and use it in GitHub Desktop.
Save menasheh/e3fe6ed57a45333582a53539ccfecd1b to your computer and use it in GitHub Desktop.
gdrive: Delete Old Backups
#!/bin/bash
FOLDER={{REPLACE WITH BACKUP FOLDER ID}}
KEEP=5
gdrive list --no-header -q "'$FOLDER' in parents" | cut -d " " -f1 | tail -n +$(expr $KEEP + 1) | xargs -n1 -I id gdrive delete id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment