2017-02-21 66 views
0

我想將文件從一個s3存儲桶移動到另一個s3存儲桶。我只想移動名稱以「part」開頭的文件。我可以使用java.But來完成它可以執行它與亞馬遜CLI。我們可以在CLI中使用GlobPattern嗎? 我的對象名稱都一樣: part0000 part0001全局模式與亞馬遜s3

回答

0

是的,這是有可能通過AWS CLI,使用--include--exclude選項。

舉個例子,你可以使用aws s3 sync命令同步您的部分文件:

aws s3 sync --exclude '*' --include 'part*' s3://my-amazing-bucket/ s3://my-other-bucket/ 

您還可以使用cp命令,與--recursive標誌:

aws s3 cp --recursive --exclude '*' --include 'part*' s3://my-amazing-bucket/ s3://my-other-bucket/ 

說明:

  • aws:aws CLI comman d
  • s3:AWS的服務與
  • sync接口:到服務的命令做
  • --exclude <value>:在UNIX風格的通配符忽略,除非包含語句
  • --include <value>:在UNIX風格通配符采取行動。

the documentation所述,您還可以多次指定--include--exclude

+0

謝謝你,這個幫了我 – Smily