2020-10-31

在 Digitalocean Spaces 使用 s3cmd

在 Digitalocean Spaces 使用 s3cmd

上一篇 基本上是廢文。 s3fs 好用,但只適合用在檔案數不多的情況下操作,而且不適合搭配 rsync 一起使用。

檔案數多時(我的狀況是有數百萬個檔案要上傳,或同步),就應該使用 s3cmd。

s3cmd 安裝方式可以參考 Digitalocean 官方的說明 Setting Up s3cmd 2.x with DigitalOcean Spaces

s3cmd 基本用法也可以參考 Examples of s3cmd 2.x Usage with DigitalOcean Spaces。當然也可以用 s3cmd --help 查詢。

以下列出自己常用的部份:

# 上傳 my_path2 整個資料夾到 s3://my_bucket/my_path2,同時設定為 public s3cmd put --acl-public --recursive /my_path1/my_path2 s3://my_bucket/
# 同步 my_path2 資料夾到 s3://my_bucket/my_path2,同時設定為 public s3cmd sync --acl-public /my_path1/my_path2 s3://my_bucket/
# 設定 s3://my_bucket/my_path2 內所有檔案為 public s3cmd setacl --acl-public --recursive s3://my_bucket/my_path2/

沒有留言:

FB 留言