windows - In this AWS CLI command, why copying files with --exclude & --include wildcards not working?
问题描述
In the following directory, I want to upload only the .html
files in top /DirA/
to the root of my AWS bucket:
/DirA/, e.g.
.file
fileA.html
fileB.html
fileC.bin
/subdirA
/subdirB
When I run the this:
me@me:/DirA$ aws s3 cp ./ s3://MYBUCKET/ --dryrun --exclude "*" --include "*.html"
The .html
files are not handled by aws and I just get the empty prompt me@me:/DirA$
back. No error or the usual (dry run) upload:
message.
I have also tried
me@me:/$ aws s3 cp /DirA/ s3://MYBUCKET/ --dryrun --exclude "*" --include "*.html"
with the same empty prompt.
Please note (if helpful):
- The above were in Ubuntu 18.04 with latest installed AWS CLI v1.
- I also installed AWS CLI in Windows and did the same, with similar empty result.
- Uploading stuff which does not require
--exclude
or--include
like that works normally
What am I doing wrong and how to fix that. Thank you very much.
解决方案
josedasilva是对的,你需要使用--recursive
旗帜。现在,要仅包含当前目录文件,您需要混合一些包含和排除标志。
这应该做的工作:
aws s3 cp --recursive ./ s3://MYBUCKET/ --exclude "*" --include "*.html" --exclude "*/*"
推荐阅读
- python - 如何在 websocket 中解码此消息
- typescript - 如何从 TypeScript 中的数字中获取所有枚举标志?
- google-cloud-vision - Google Cloud Vision:使用 get_similar_products_file 与 localize_objects 查找更少的对象
- dataweave - 在 mule3 中拆分有效负载时出现类型不匹配错误
- html - 如何通过html中的form标签发送换行符“\n”
- python - 对字符串与文本的关联程度进行评分
- c# - 如何在 C# Unity 中加载带有扩展名(.json)的资产文件夹中的任何文件
- laravel - 对齐在 phpWord TemplateProcessor 中不起作用
- mongodb - 需要在 Mongo 和 Redash 中从每月 1 日开始获取文件
- celery - ValueError:不支持的pickle协议:在Airflow中运行作业时为5