amazon-web-services - AWS CLI移动文件,路径中带有通配符(星号)

标签 amazon-web-services amazon-s3 amazon-data-pipeline

我正在尝试使用AWS数据管道中的事件将文件从s3位置移动到另一个文件。
我正在使用的命令是:

(aws s3 mv s3://foobar/Tagger/out//*/lastImage.txt s3://foobar/Tagger/testInput/lastImage.txt)
但是我收到以下错误:
A client error (404) occurred when calling the HeadObject operation: Key "Tagger/out//*/lastImage.txt" does not exist
但是,如果我将“*”替换为特定的目录名称,它将起作用。问题是我不总是知道目录的名称,所以我希望可以将“*”用作通配符。

最佳答案

仅当使用--recursive标志时,AWS S3 CLI中的通配符才起作用。

因此,这应该为您工作:

aws s3 mv s3://foobar/Tagger/out/ s3://foobar/Tagger/testInput/ --recursive --exclude "*" --include "*/lastImage.txt"

不幸的是,这将在您的目标位置重新创建整个目录结构,我不确定立即使用AWS CLI即可解决此问题。

关于amazon-web-services - AWS CLI移动文件,路径中带有通配符(星号),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31629552/

相关文章:

python - Django Pandas AWS

python - 无法解析 boto3 python 中的 AWS DynamoDB 二进制获取项目

python - AWS 上多个 API 之间的共享 Python 库

mysql - AWS数据管道-从外部源提取数据?

amazon-s3 - 如何在设置 DataPipeline 以将 DynamoDB 数据导出到 S3 时计算 'DynamoDB read throughput ratio'

amazon-web-services - AWS 事件规则不起作用

java - 使用 S3 存储桶名称查找 AWS 账户 ID

python - 将 openpyxl 与 lambda 结合使用

amazon-web-services - AWS Data Pipeline 中有任何东西可以通过决策脚本停止执行特定事件吗?

amazon-web-services - "type mismatch error, expected type LIST"用于查询 AppSync 中的一对多关系