2016-07-15 134 views
0

我試圖使用AWS CLI命令來執行以下命令 -AWS CLI命令

aws s3 cp s3://my_bucket/folder/file_1234.txt -| pipe to sed command | pipe to jq command | aws s3 cp - s3://my_bucket/new_folder/final_file.txt 

上面的代碼工作正常 - 基本上從S3中提取數據,做一些操作,將其推回S3。

現在,我有一些文件在s3中有一個模式 - 例如 - file_771.txt,file_772.txt,file_773.txt等。

現在爲了獲得所有匹配模式的文件,我正在執行以下不按預期工作的操作。它在s3中生成一個空的輸出文件。

aws s3 cp --include file_77* s3://my_bucket/folder/ -| pipe to sed command | pipe to jq command | aws s3 cp - s3://my_bucket/new_folder/final_file.txt 

此代碼生成空的final_file.txt。任何原因 ?我在代碼中丟失了什麼嗎?

+0

僅此一點'AWS S3 CP --include file_77 * S3:// MY_BUCKET /文件夾/ -'應該產生一個錯誤,我認爲? –

回答

1

要一次複製多個文件,你將不得不使用--recursive,你的情況與--exclude "*" --include "file_77*",但:

下載一個流不是目前與 --recursive參數兼容

cp