Google Drive のデータをクラウドサービス経由で別のアカウントに移す
2020/02/22 17:20:182021/02/27 16:37:21
rename.py import pathlib
d = """重複したディレクトリのリストのテキスト"""
for line in d.split("\n"):
if line.startswith("skicka:") and "mkdir" not in line:
prefix, path, msg = line.split(": ")
if "skipping download of duplicate file on Drive" in msg:
p = pathlib.Path(f"/content/gdrive/My Drive/{path}")
if p.exists():
print(f"リネームします: {path}")
p.rename(p.with_name(f"{p.stem}_{p.suffix}"))
else:
print(f"なかったです: {path}")bash.sh $ sudo yum install -y wget tmux
# https://golang.org/dl/ から最新のバージョンを探してくる
$ wget https://dl.google.com/go/go1.13.8.linux-amd64.tar.gz
$ sudo tar -C /usr/local -xzf go[tab]
$ vim .bash_profile.bash_profile export PATH=$PATH:$HOME/bin:/usr/local/go/bin
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/binbash.sh # いったん落ちてもいいし source で反映させてもいいです
$ go get github.com/google/skicka
$ skicka init
# 書いた時点では skicka の CSCK が無効化されてるので
# https://console.cloud.google.com/apis/credentials で作ってきてください
$ vim .skicka.config.skicka.config [google]
clientid=取ってきたclientid
clientsecret=取ってきたbash.sh $ skicka -no-browser-auth lsmount.sh $ sudo lsblk
# 一番下に出てくる sdb みたいなのが追加でマウントしたディスク
$ sudo mkfs.ext4 -m 0 -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/sdb # 最初だけ
$ sudo mkdir -p /mnt/disks/sdb # 最初だけ
$ sudo mount -o discard,defaults /dev/sdb /mnt/disks/sdb
$ sudo chmod a+w /mnt/disks/sdbin tmux.sh $ cd /mnt/disks/sdb
$ mkdir -p ... # ダウンロードしたいディレクトリ相対構造(自由)
$ skicka download [落としたいGoogleDrive上ディレクトリパス] [上のmkdirで作ったdir]110GBのダウンロード 2020/02/23 06:02:06 Preparation time 8s, sync time 12h 56m 51s
2020/02/23 06:02:06 Updated 0 Drive files, 203911 local files
2020/02/23 06:02:06 0 B read from disk, 109.83 GiB written to disk
2020/02/23 06:02:06 0 B uploaded (0 B/s), 109.83 GiB downloaded (2.41 MiB/s)
2020/02/23 06:02:06 864.95 MiB peak memory used60GBのダウンロード 2020/02/23 22:30:24 Preparation time 10s, sync time 8h 6m 32s
2020/02/23 22:30:24 Updated 0 Drive files, 134292 local files
2020/02/23 22:30:24 0 B read from disk, 59.42 GiB written to disk
2020/02/23 22:30:24 0 B uploaded (0 B/s), 59.42 GiB downloaded (2.08 MiB/s)
2020/02/23 22:30:24 801.88 MiB peak memory used-metadata-cache-file -tokencache -no-browser-auth ls とでもすると別のアカウントでのセッションになる -config だけで済むが…できない? upload.sh $ skicka skicka -metadata-cache-file ~/.skicka.metadata2.cache -tokencache ~/.skicka.token2.cache upload /mnt/disks/sdb/content /contentupload Directories: 23295 / 23295 [===================================================================] 100.00% 4h49m58s
Files: 66.85 GiB / 180.29 GiB [=======================>---------------------------------------] 37.08% 18h50m45supload Files: 29.17 GiB / 102.38 GiB [=================>-------------------------------------------] 28.50% 1d10h27m23supload Files: 73.19 GiB / 73.19 GiB [===================================================================] 100.00% 69h0m47s
2020/02/28 10:09:46 Preparation time 2m 57s, sync time 69h 1m 52s
2020/02/28 10:09:46 Updated 250029 Drive files, 0 local files
2020/02/28 10:09:46 73.19 GiB read from disk, 0 B written to disk
2020/02/28 10:09:46 73.19 GiB uploaded (308.80 kiB/s), 0 B downloaded (0 B/s)
2020/02/28 10:09:46 349.87 MiB peak memory usedGenerated from
Google Drive のデータをクラウドサービス経由で別のアカウントに移す