LoginSignup
17
21

More than 5 years have passed since last update.

Google Drive と連携するファイル操作ユーティリティ Skicka が便利すぎてやばい

Last updated at Posted at 2014-09-27

Matt Pharr 大先生がいつのまにやら golang で Google Drive と連携するコマンドラインファイル操作ユーティリティ作ってました.

漢なら黙って活用ですね!

何ができるか

$ skicka upload ~/Pictures /Pictures

ローカルの ~/Pictures フォルダの中身を Google Drive の /Pictures フォルダにアップロード.
rsync のように差分を検出して変更したものだけアップロードします.

$ skicka download /Pictures ~/Pictures

Google Drive の /Pictures フォルダをローカルの ~/Pictures フォルダにダウンロード

$ skicka ls /Pictures

Google Drive の /Pictures フォルダの内容を表示.

素敵ですね!

インストールとセットアップ

$ go get github.com/google/skicka
$ go build github.com/google/skicka
# $GOPATH/bin/skicka を PATH の通ったところにコピー
$ skicka init

# Google Developer Console から client id, client secret を取得して ~/.skicka.config に記述

$ skicka ls /
# oath2 トークンを取得…

# トークン取得後に再度
$ skicka ls /

既知の問題点

ファイル名が同じものがあるとき

Google Drive 上に同名のファイルが存在していると

skicka: /myfile.txt: duplicate file found on Google Drive

というエラーが表示されてうまく動きません. Google Drive では同名のファイルを同一ディレクトリに作れる(hash 値は異なる)のですが, posix 的なシステムではそれを正しく扱えないため, skicka ではエラーを出すようにしているためです.
(skika の README には書いていないので気をつけて!)

ディレクトリには同一のファイル名が無いように構成してみましょう.

さらに

暗号化や転送レート制御もできます. 期待ですね!

17
21
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
21