當您需要快速上傳大檔案、下載檔案、大量刪除特定首碼檔案時,可以使用ossutil工具。ossutil支援在Windows、Linux、macOS等系統中運行,您可以根據實際環境下載和安裝合適的版本。
版本
目前的版本:2.1.1
下載ossutil
下載地址 | SHA256校正和 |
af77d281229d51df7fd15d645a842dec97f6be4eeb245db20f90f197ac1cdfb3 | |
60f3a808cbbdfd4b5269b8f967c6a66f564c9dacff52d93a5d21a588976ab5a2 | |
0861cca6454307f884a4f54d73c8af42f8abe4fea4cb189b1481f37ca6aee3a8 | |
a22a50d528b54c806aeadbc65289ac03769b64265d2121e9221df7678bdb4f63 | |
10a6b6189542c21577513e18e6d4804bf80d99e88a6264801bdb7b1ec4419725 | |
ee699ca71a98ca9d42ad345058376f10f4e917f452b454a3e26b59911c7b08fc | |
f2d8cf95e9718d894d3f207b05b0d4649636c862cf25a05e4e38f4291732c8e9 | |
8797230d56ade91e7002fca3bdd72ab6a5e0d215867f0998241d91611afce120 | |
00b46eee2e9899a1cd6b26a3e6b8162f0f4dd488b4ae0afe2f84314b1f530701 |
安裝ossutil
Linux
安裝ossutil。
下載ossutil壓縮包。
curl -o ossutil-2.1.1-linux-amd64.zip https://gosspublic.alicdn.com/ossutil/v2/2.1.1/ossutil-2.1.1-linux-amd64.zip
說明此處以Linux x86 64bit為例進行介紹。其他系統下載地址,請參見下載ossutil。
在下載壓縮包的所在目錄執行以下解壓命令。
unzip ossutil-2.1.1-linux-amd64.zip
進入ossutil-2.1.1-linux-amd64目錄。
cd ossutil-2.1.1-linux-amd64
在目前的目錄執行以下命令。
chmod 755 ossutil
執行以下命令,實現ossutil的全域調用。
sudo mv ossutil /usr/local/bin/ && sudo ln -s /usr/local/bin/ossutil /usr/bin/ossutil
驗證是否成功安裝ossutil。
ossutil
返回ossutil的協助資訊即表示安裝成功。
配置ossutil。
輸入配置命令。
ossutil config
根據提示設定設定檔路徑。您可以直接斷行符號使用預設的設定檔路徑。
Please enter the config file name,the file name can include path(default /root/.ossutilconfig, carriage return will use the default file. If you specified this option to other file, you should specify --config-file option to the file when you use other commands):
ossutil預設使用/root/.ossutilconfig作為設定檔,若您設定了設定檔的路徑,則每次使用命令時需增加-c選項指定設定檔。例如設定檔儲存為/home/config,使用ls時,命令格式如下:
ossutil ls oss://examplebucket -c /home/config
根據提示分別設定AccessKey ID、AccessKey Secret、地區ID資訊。
輸入您建立的AccessKey ID。
Please enter Access Key ID [****************id]:LTAI****************
輸入您建立的AccessKey Secret。
Please enter Access Key Secret [****************sk]:R6vg*********************
輸入您的OSS的資料中心所在的地區,如無任何輸入,預設值為cn-hangzhou。
Please enter Region [cn-hangzhou]:cn-hangzhou
輸入您的OSS的資料中心的Endpoint,如果您不需要自訂 Endpoint,可以直接按斷行符號跳過該參數的配置。
在上一步配置完地區資訊後,將預設使用該地區 ID 對應的外網 Endpoint。例如,如果您設定的
region-id
為cn-hangzhou
,預設使用的外網 Endpoint 是https://oss-cn-hangzhou.aliyuncs.com
。如果您需要自訂 OSS 資料中心所在地區的 Endpoint,請輸入您的 Endpoint 資訊。例如,如果您希望通過與OSS同地區的其他阿里雲產品訪問OSS,請使用內網Endpoint如
https://oss-cn-hangzhou-internal.aliyuncs.com
Please enter Endpoint (optional, use public endpoint by default) [None]: https://oss-cn-hangzhou-internal.aliyuncs.com
參數說明如下:
參數
是否必填
說明
accessKeyID
是
填寫帳號的AccessKey,AccessKey的擷取方式,請參見建立AccessKey。
accessKeySecret
是
Region
是
填寫Bucket所在的地區ID,本文以杭州地區為例,設定為cn-hangzhou,其他地區的ID參見OSS地區和訪問網域名稱。
endpoint
否
填寫Bucket所在地區的Endpoint。例如,使本樣本使用華東1(杭州)外網Endpoint,設定為
https://oss-cn-hangzhou.aliyuncs.com
。如果您希望通過與OSS同地區的其他阿里雲產品訪問OSS,請使用內網Endpoint,設定為
https://oss-cn-hangzhou-internal.aliyuncs.com
。關於各地區Endpoint的更多資訊,請參見OSS地區和訪問網域名稱。
Windows
安裝ossutil。
請根據您的系統架構或系統版本下載對應的安裝包:
x86_32架構:Windows x86 32bit。
x86_64架構:Windows x86 64bit。
Windows 7、Windows8以及Windows Server 2008R2系統版本請下載:Windows 7, Windows 8, Windows Server 2008R2。
將下載好的.zip壓縮包解壓到目標檔案夾,然後進入解壓後的目錄,如圖所示。
複製當前解壓後ossutil檔案夾路徑配置系統內容變數。
單擊目前的目錄的路徑欄,複製其中顯示的當前檔案夾路徑。
開啟環境變數對話方塊,在系統變數欄中找到並雙擊Path變數,單擊建立按鈕,然後將複製好的ossutil檔案夾路徑粘貼到新的條目框中。
開啟命令列,執行
ossutil
命令,返回ossutil的協助資訊即表示安裝成功。ossutil
配置ossutil。
輸入配置命令。
ossutil config
根據提示設定設定檔路徑。您可以直接斷行符號使用預設的設定檔路徑。
Please enter the config file name,the file name can include path(default "C:\Users\issuser\.ossutilconfig", carriage return will use the default file. If you specified this option to other file, you should specify --config-file option to the file when you use other commands):
ossutil預設使用C:\Users\issuser\.ossutilconfig作為設定檔,若您設定了設定檔的路徑,則每次使用命令時需增加-c選項指定設定檔。例如設定檔儲存為c:\ossutil\config,使用ls時,命令格式如下:
ossutil ls oss://examplebucket -c c:\ossutil\config
根據提示分別設定AccessKey ID、AccessKey Secret、地區ID資訊。
輸入您建立的AccessKey ID。
Please enter Access Key ID [****************id]:LTAI****************
輸入您建立的AccessKey Secret。
Please enter Access Key Secret [****************sk]:R6vg*********************
輸入您的OSS的資料中心所在的地區,如無任何輸入,預設值為cn-hangzhou。
Please enter Region [cn-hangzhou]:cn-hangzhou
輸入您的OSS的資料中心的Endpoint,如果您不需要自訂 Endpoint,可以直接按斷行符號跳過該參數的配置。
在上一步配置完地區資訊後,將預設使用該地區 ID 對應的外網 Endpoint。例如,如果您設定的
region-id
為cn-hangzhou
,預設使用的外網 Endpoint 是https://oss-cn-hangzhou.aliyuncs.com
。如果您需要自訂 OSS 資料中心所在地區的 Endpoint,請輸入您的 Endpoint 資訊。例如,如果您希望通過與OSS同地區的其他阿里雲產品訪問OSS,請使用內網Endpoint如
https://oss-cn-hangzhou-internal.aliyuncs.com
Please enter Endpoint (optional, use public endpoint by default) [None]: https://oss-cn-hangzhou-internal.aliyuncs.com
參數說明如下:
參數
是否必填
說明
accessKeyID
是
填寫帳號的AccessKey,AccessKey的擷取方式,請參見建立AccessKey。
accessKeySecret
是
Region
是
填寫Bucket所在的地區ID,本文以杭州地區為例,設定為cn-hangzhou,其他地區的ID參見OSS地區和訪問網域名稱。
endpoint
否
填寫Bucket所在地區的Endpoint。例如,使本樣本使用華東1(杭州)外網Endpoint,設定為
https://oss-cn-hangzhou.aliyuncs.com
。如果您希望通過與OSS同地區的其他阿里雲產品訪問OSS,請使用內網Endpoint,設定為
https://oss-cn-hangzhou-internal.aliyuncs.com
。關於各地區Endpoint的更多資訊,請參見OSS地區和訪問網域名稱。
macOS
安裝ossutil。
下載ossutil壓縮包。
curl -o ossutil-2.1.1-mac-arm64.zip https://gosspublic.alicdn.com/ossutil/v2/2.1.1/ossutil-2.1.1-mac-arm64.zip
說明此處以macOS ARM 64bit為例進行介紹。其他系統下載地址,請參見下載ossutil。
在下載壓縮包的所在目錄執行以下解壓命令。
unzip ossutil-2.1.1-mac-arm64.zip
進入ossutil-2.1.1-mac-arm64目錄。
cd ossutil-2.1.1-mac-arm64
在目前的目錄執行以下命令。
chmod 755 ossutil
執行以下命令,實現ossutil的全域調用。
sudo mv ossutil /usr/local/bin/ && sudo ln -s /usr/local/bin/ossutil /usr/bin/ossutil
驗證是否成功安裝ossutil。
ossutil
返回ossutil的協助資訊即表示安裝成功。
配置ossutil。
輸入配置命令。
ossutil config
根據提示設定設定檔路徑。您可以直接斷行符號使用預設的設定檔路徑。
Please enter the config file name,the file name can include path(default "/Users/user/.ossutilconfig", carriage return will use the default file. If you specified this option to other file, you should specify --config-file option to the file when you use other commands):
ossutil預設使用/Users/user/.ossutilconfig作為設定檔,若您設定了設定檔的路徑,則每次使用命令時需增加-c選項指定設定檔。例如設定檔儲存為/home/config,使用ls時,命令格式如下:
ossutil ls oss://examplebucket -c /home/config
根據提示分別設定AccessKey ID、AccessKey Secret、地區ID資訊。
輸入您建立的AccessKey ID。
Please enter Access Key ID [****************id]:LTAI****************
輸入您建立的AccessKey Secret。
Please enter Access Key Secret [****************sk]:R6vg*********************
輸入您的OSS的資料中心所在的地區,如無任何輸入,預設值為cn-hangzhou。
Please enter Region [cn-hangzhou]:cn-hangzhou
輸入您的OSS的資料中心的Endpoint,如果您不需要自訂 Endpoint,可以直接按斷行符號跳過該參數的配置。
在上一步配置完地區資訊後,將預設使用該地區 ID 對應的外網 Endpoint。例如,如果您設定的
region-id
為cn-hangzhou
,預設使用的外網 Endpoint 是https://oss-cn-hangzhou.aliyuncs.com
。如果您需要自訂 OSS 資料中心所在地區的 Endpoint,請輸入您的 Endpoint 資訊。例如,如果您希望通過與OSS同地區的其他阿里雲產品訪問OSS,請使用內網Endpoint如
https://oss-cn-hangzhou-internal.aliyuncs.com
Please enter Endpoint (optional, use public endpoint by default) [None]: https://oss-cn-hangzhou-internal.aliyuncs.com
參數說明如下:
參數
是否必填
說明
accessKeyID
是
填寫帳號的AccessKey,AccessKey的擷取方式,請參見建立AccessKey。
accessKeySecret
是
Region
是
填寫Bucket所在的地區ID,本文以杭州地區為例,設定為cn-hangzhou,其他地區的ID參見OSS地區和訪問網域名稱。
endpoint
否
填寫Bucket所在地區的Endpoint。例如,使本樣本使用華東1(杭州)外網Endpoint,設定為
https://oss-cn-hangzhou.aliyuncs.com
。如果您希望通過與OSS同地區的其他阿里雲產品訪問OSS,請使用內網Endpoint,設定為
https://oss-cn-hangzhou-internal.aliyuncs.com
。關於各地區Endpoint的更多資訊,請參見OSS地區和訪問網域名稱。