亞馬遜S3雲,利用curl獲取檔案列表
阿新 • • 發佈:2019-01-29
#!/bin/bash date=$(for i in $(date "+%H") ; do date "+%a, %d %b %Y $(( 10#$i-8)):%M:%S GMT" ; done) token="token" secret="祕鑰" query2="路徑,不填應該是這個token下面的根目錄" header="GET\n\n\n${date}\n/${query2}" echo "##############################" echo $header echo "##############################" sig=$(echo -en ${header} | openssl sha1 -hmac ${secret} -binary | base64) echo $sig echo "##############################" curl -v -H "Date: ${date}" -H "Authorization: AWS ${token}:$sig" -L -X GET "http://s3.bestcloud.cn/${query2}" -H "Host:s3.bestcloud.cn"