Rclone: Синхронизация файлов и папок с Google Drive и не только.

Софт работает как под linux, так и под windows. Команды идентичные.
В арсенале не только google drive, поддерживается множество облачных решений.
https://rclone.org/downloads/

Установка rclone:
apt install rclone
Настройка:
rclone config

Подключение к диску.

Добавляем аккаунт n) New remote:

No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n

Обзываем его как вам удобнее:

name> google-drive
Выбираем нужную систему, в нашем случае google drive под номером 13:

Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
 1 / 1Fichier
   \ "fichier"
 2 / Alias for an existing remote
   \ "alias"
 3 / Amazon Drive
   \ "amazon cloud drive"
 4 / Amazon S3 Compliant Storage Provider (AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, etc)
   \ "s3"
 5 / Backblaze B2
   \ "b2"
 6 / Box
   \ "box"
 7 / Cache a remote
   \ "cache"
 8 / Citrix Sharefile
   \ "sharefile"
 9 / Dropbox
   \ "dropbox"
10 / Encrypt/Decrypt a remote
   \ "crypt"
11 / FTP Connection
   \ "ftp"
12 / Google Cloud Storage (this is not Google Drive)
   \ "google cloud storage"
13 / Google Drive
   \ "drive"
14 / Google Photos
   \ "google photos"
15 / Hubic
   \ "hubic"
16 / In memory object storage system.
   \ "memory"
17 / Jottacloud
   \ "jottacloud"
18 / Koofr
   \ "koofr"
19 / Local Disk
   \ "local"
20 / Mail.ru Cloud
   \ "mailru"
21 / Mega
   \ "mega"
22 / Microsoft Azure Blob Storage
   \ "azureblob"
23 / Microsoft OneDrive
   \ "onedrive"
24 / OpenDrive
   \ "opendrive"
25 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ "swift"
26 / Pcloud
   \ "pcloud"
27 / Put.io
   \ "putio"
28 / QingCloud Object Storage
   \ "qingstor"
29 / SSH/SFTP Connection
   \ "sftp"
30 / Sugarsync
   \ "sugarsync"
31 / Tardigrade Decentralized Cloud Storage
   \ "tardigrade"
32 / Transparently chunk/split large files
   \ "chunker"
33 / Union merges the contents of several upstream fs
   \ "union"
34 / Webdav
   \ "webdav"
35 / Yandex Disk
   \ "yandex"
36 / http Connection
   \ "http"
37 / premiumize.me
   \ "premiumizeme"
38 / seafile
   \ "seafile"
Storage> 13
** See help for drive backend at: https://rclone.org/drive/ **
На данные пункты отвечаем дефолтом, ничго не вписывая:

Google Application Client Id
Setting your own is recommended.
See https://rclone.org/drive/#making-your-own-client-id for how to create your own.
If you leave this blank, it will use an internal key which is low performance.
Enter a string value. Press Enter for the default ("").
client_id>
Google Application Client Secret
Setting your own is recommended.
Enter a string value. Press Enter for the default ("").
client_secret>
Даем необходимый под вши нужды доступ:

Choose a number from below, or type in your own value
 1 / Full access all files, excluding Application Data Folder.
   \ "drive"
 2 / Read-only access to file metadata and file contents.
   \ "drive.readonly"
   / Access to files created by rclone only.
 3 | These are visible in the drive website.
   | File authorization is revoked when the user deauthorizes the app.
   \ "drive.file"
   / Allows read and write access to the Application Data folder.
 4 | This is not visible in the drive website.
   \ "drive.appfolder"
   / Allows read-only access to file metadata but
 5 | does not allow any access to read or download file content.
   \ "drive.metadata.readonly"
Далее так же все оставляем по дефолту, в какой-то момент вас перекинет в браузер или появится ссылка для авторизации:

ID of the root folder
Leave blank normally.

Fill in to access "Computers" folders (see docs), or for rclone to use
a non root folder as its starting point.

Note that if this is blank, the first time rclone runs it will fill it
in with the ID of the root folder.

Enter a string value. Press Enter for the default ("").
root_folder_id>
Service Account Credentials JSON file path
Leave blank normally.
Needed only if you want use SA instead of interactive login.
Enter a string value. Press Enter for the default ("").
service_account_file>
Edit advanced config? (y/n)
y) Yes
n) No (default)
y/n> n
Remote config
Use auto config?
 * Say Y if not sure
 * Say N if you are working on a remote or headless machine
y) Yes (default)
n) No
y/n> y
If your browser doesnt open automatically go to the following link: http://127.0.0.1:53682/auth?state=_0wy14_PRwG7lfM4kHAbkQ
Log in and authorize rclone for access
Waiting for code...
Got code
Configure this as a team drive?
y) Yes
y/n> n
[google-drive]
type = drive
scope = drive.readonly
token = {"access_token":"ya29.a0AfH6SMBNkYS0V9paI6n2rlWx9F2YWI7yNHS9xqojDNRGXgxF_qImpwasdasscSFWQ232r23dwXBpHblAuISztNgNO3-wkLstLvtv97uBE_5RM-w82mSEg7z40hBEJKh54nRLXDo6MJLvUtmJTjSD0bl-NfLTn0k","token_type":"Bearer","refresh_token":"1//0cb8yAеbkLswergYI35WSjRAAGAwSNwF-L9IrEQsTsCX_3VS5dQTejPkgdlBWUne2f23f334f3dWQfyg5IeZONureXd2f23ftL5QPwHElR08-qXs","expiry":"2020-10-07T10:37:54.85547d5+03:00"}
--------------------
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y
Current remotes:

Name                 Type
====                 ====
google-drive   drive

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q
Подключение завершено.

Манипуляции с файлами на диске.

В программе вполне понятный --help, но напишу самые ходовые команды:

rclone mkdir google-drive:[folder] - создание папки в облаке
rclone copy [local-src] google-drive:[folder] - копирование в облако
rclone copy google-drive:[folder] [local-src] - копирование в локальную папку
rclone sync [local-src] google-drive:[folder] - синхронизация с облаком приоритет на локальной папке
rclone sync google-drive:[folder] [local-src] - синхронизация с облаком приоритет на облако
rclone lsd google-drive: - показать созданные [folder]
rclone ls google-drive:[folder] - показать файлы в [folder]
Поделиться:

Нет комментариев