-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgdrive
More file actions
executable file
·43 lines (37 loc) · 1.22 KB
/
gdrive
File metadata and controls
executable file
·43 lines (37 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# Purpose: a script for copying from GoogleDrive using rclone
# Input : a folder from Google Drive to copy onto this computer
# Author : Liam Timms
MINPARAMS=1
localpath=~/Documents/GoogleDrive/
inputfolder="${currentfolder#$localpath}"
#Usage(){ echo "$0; This script requires a source google drive folder"; exit 1; }
operation="$1"
inputfolder="$2"
# rclone syntax is like:
# Syntax: [options] subcommand <parameters> <parameters...>
# STATUS
if [ "$operation" == "status" ]; then
rclone check "$PWD" remote:"${PWD##*/GoogleDrive/}"
exit 1
# CLONE
elif [ "$operation" == "clone" ]; then
echo "Cloning into ~/Documents/GoogleDrive/"
echo "$inputfolder"
rclone copy remote:"$inputfolder" ~/Documents/GoogleDrive/$inputfolder -P
exit 2
# PUSH
elif [ "$operation" == "push" ]; then
echo "pushing local version of:"
echo "$inputfolder"
rclone copy "$PWD" remote:"${PWD##*/GoogleDrive/}"
# PULL
elif [ "$operation" == "pull" ]; then
echo "pulling remote version of:"
echo "${PWD##*/GoogleDrive/}"
rclone sync remote:"${PWD##*/GoogleDrive/}" "$PWD"
fi
# LIST
# TODO: add check, push, pull, capabilities. Maybe just make this like git?
# rclone check source:path dest:path
# push - rclone copy source:localpath dest:path