【问题标题】:AWS CLI CommandAWS CLI 命令
【发布时间】:2016-07-15 11:24:06
【问题描述】:

我正在尝试使用 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。任何原因 ?我在代码中遗漏了什么吗?

【问题讨论】:

  • 我认为仅此 aws s3 cp --include file_77* s3://my_bucket/folder/ - 应该会产生错误?

标签: json amazon-web-services command-line-interface aws-cli


【解决方案1】:

要一次复制多个文件,您必须使用--recursive,在您的情况下使用--exclude "*" --include "file_77*",但是:

作为流下载目前与 --递归参数

cp

【讨论】:

    猜你喜欢
    • 2015-12-24
    • 2023-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-29
    • 1970-01-01
    相关资源
    最近更新 更多