日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

s3cmd用法总结

發布時間:2023/12/20 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 s3cmd用法总结 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

概述

S3是亞馬遜AWS提供的簡單存儲服務(可以理解為有公網域名的大容量高可用存儲)
S3配合CloudFront服務可作為CDN使用,它提供多節點全球發布

安裝

方法一:

yum install s3cmd

方法二:

yum install -y python-pip (python > version2.6) pip install s3cmd

配置:

s3cmd --configure#vim /root/.s3cfg

s3cmd相關指令

創建新Bucket:

s3cmd mb s3://mybucket

list當前bucket:

s3cmd ls

列出bucket中的文件:

s3cmd --recursive ls s3://mybucket2 #--recursive 遞歸列舉 s3cmd --recursive ls s3://mybucket2/rgw

文件上傳:

s3cmd put demo.xml s3://mybucket2/demo.xml #上傳目錄 s3cmd put --recursive dir1 dir2 s3://mybucket2/dir1 #目標目錄不用提前創建,上傳時會自動創建

文件下載:

s3cmd get s3://mybucket2/demo.xml demo2.xml #下載目錄 s3cmd get --recursive s3://mybucket2/dir1#帶目錄樹下載 s3cmd get --recursive s3://mybucket2/dir1/*

刪除:

s3cmd del s3://mybucket2/demo.xml s3cmd del --recursive s3://mybucket2/dir1/ #整個目錄樹

刪除bucket:

s3cmd rb s3://mybucket2 # bucket 必須為empty,否則需要帶--force 強制刪除

同步:

s3cmd sync ./ s3://mybucket2 #同步當前目錄下所有文件 s3cmd sync --delete-removed ./ s3://mybucket2 # 會刪除本地不存在的文件 s3cmd sync --skip-existing ./ s3://mybucket2 # 不進行MD5校驗,直接跳過本地已存在的文件

高級同步操作

  • 排除、包含規則(- -exclude 、- -include)

    s3cmd sync --exclude '.doc' --include 'dir2/' ./ s3://mybucket2/

  • 從文件中載入排除或包含規則。(- -exclude-from、- -include-from)

    s3cmd sync --exclude-from exclude.txt ./ s3://mybucket2/

    exclude.txt 文件內容:

    #comments here

    .jpg

    .gif

  • 排除或包含規則支持正則表達式

    --rexclude 、--rinclude、--rexclude-from、--rinclude-from

總結

以上是生活随笔為你收集整理的s3cmd用法总结的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。