2019年6月13日

google drive 同步工具:grive


Grive 指令工具,可以讓Google 雲端硬碟跟本機硬碟中的檔案同步

==grive 2.0的安裝==

用 PPA,參見 Grive2
在 terminal 中下指令:
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install grive
 或從 github 自行下載 compile (see grive2)

==grive 的使用參數==

source: http://blog.ilc.edu.tw/blog/index.php?op=printView&articleId=649021&blogId=25793

-v 列出 grive 版本
/usr/local/bin/grive -v
grive version 0.5.1-dev Jun 30 2016 13:33:47

-a 取得授權碼
/usr/local/bin/grive -a

-p 要同步的根目錄,同步到 Google Drive 後,呈現的就是 /home/t850008/Google 目錄下的檔案及目錄
/usr/local/bin/grive -p /home/t850008/Google

-s 單一子目錄同步
/usr/local/bin/grive -s /home/t850008/Google/123

-V 詳細模式,啟用比正常更多的訊息
/usr/local/bin/grive -p /home/t850008/Google -V
config file name "/home/t850008/Google/.grive"
Reading local directories
file .grive_state is ignored by grive
file .grive is ignored by grive
Reading remote server file list
file "/home/t850008/Google/格式工廠 format factory 3.8.0.0 中文免安裝版.exe" is already in sync
Synchronizing files
sync "/home/t850008/Google" already in sync
sync "/home/t850008/Google/pCloud_Windows_3.2.4.exe" deleted in remote. deleting local
sync "/home/t850008/Google/格式工廠 format factory 3.8.0.0 中文免安裝版.exe" already in sync
change stamp is set to 14
Finished!

-l 設定輸入的 log 檔的檔案名稱

-f 強制
/usr/local/bin/grive -p /home/t850008/Google -f

-u 不從 Google Drive 下載檔案, 只上傳本地端有改變的檔案
/usr/local/bin/grive -p /home/t850008/Google -u

-n 只下載 Google Drive 有改變且已存在本地端的檔案,也會上傳本地端的檔案到 Google Drive
/usr/local/bin/grive -p /home/t850008/Google -n

--dry-run 只偵測哪些檔案要處理,並不實際做檔案的上傳或下載
/usr/local/bin/grive -p /home/t850008/Google --dry-run

--ignore 使用 Perl 常規表示式來過濾一些不處理的目錄(針對相對應目錄處理)

-U 限制上傳的速度  kbytes per second
-D 限制下載的速度  kbytes per second

==grive -h==

~ $ grive -h
Grive options:
  -h [ --help ]               Produce help message
  -v [ --version ]            Display Grive version
  -a [ --auth ]               Request authorization token
  -i [ --id ] arg             Authentication ID
  -e [ --secret ] arg         Authentication secret
  -p [ --path ] arg           Path to working copy root
  -s [ --dir ] arg            Single subdirectory to sync
  -V [ --verbose ]            Verbose mode. Enable more messages than normal.
  --log-http arg              Log all HTTP responses in this file for
                              debugging.
  --new-rev                   Create new revisions in server for updated files.
  -d [ --debug ]              Enable debug level messages. Implies -v.
  -l [ --log ] arg            Set log output filename.
  -f [ --force ]              Force grive to always download a file from Google
                              Drive instead of uploading it.
  -u [ --upload-only ]        Do not download anything from Google Drive, only
                              upload local changes
  -n [ --no-remote-new ]      Download only files that are changed in Google
                              Drive and already exist locally
  --dry-run                   Only detect which files need to be
                              uploaded/downloaded, without actually performing
                              them.
  -U [ --upload-speed ] arg   Limit upload speed in kbytes per second
  -D [ --download-speed ] arg Limit download speed in kbytes per second
  -P [ --progress-bar ]       Enable progress bar for upload/download of files