Skip to content

Instantly share code, notes, and snippets.

@marianmirzacu
Last active July 17, 2019 08:46
Show Gist options
  • Save marianmirzacu/93b3478dc0446e5804c4e3298ba57939 to your computer and use it in GitHub Desktop.
Save marianmirzacu/93b3478dc0446e5804c4e3298ba57939 to your computer and use it in GitHub Desktop.
archive and upload to onedrive (or other cloud storage) my work folder
#!/bin/bash
HOME=/mnt/e/work
DIRS=`ls $HOME`
TIMESTAMP=$(date +"%F")
for dir in $DIRS;do
echo "START backup $dir"
zip -rq "$HOME"/"$dir".zip "$HOME"/"$dir"/*
echo "START transfer $dir"
rclone copy "$HOME"/"$dir".zip onedrive:backup/personal/home/work/"$TIMESTAMP" --config="/home/USERNAME/.config/rclone/rclone.conf"
rm "$HOME"/"$dir".zip
done
echo "ALL DONE!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment