首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用亚马逊网络服务S3同步排除多个文件夹

使用亚马逊网络服务S3同步排除多个文件夹
EN

Stack Overflow用户
提问于 2015-09-04 16:01:55
回答 4查看 61.5K关注 0票数 67

如何在使用亚马逊网络服务s3 syn时排除多个文件夹?

我试过了:

代码语言:javascript
运行
复制
# aws s3 sync  s3://inksedge-app-file-storage-bucket-prod-env   s3://inksedge-app-file-storage-bucket-test-env --exclude 'reportTemplate/* orders/* customers/*'

但它仍然在同步文件夹"customer“

输出:

代码语言:javascript
运行
复制
copy: s3://inksedge-app-file-storage-bucket-prod-env/customers/116/miniimages/IMG_4800.jpg to s3://inksedge-app-file-storage-bucket-test-env/customers/116/miniimages/IMG_4800.jpg
copy: s3://inksedge-app-file-storage-bucket-prod-env/customers/116/miniimages/DSC_0358.JPG to s3://inksedge-app-file-storage-bucket-test-env/customers/116/miniimages/DSC_0358.JPG
EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2015-09-04 17:35:09

最后,这对我起作用了:

代码语言:javascript
运行
复制
aws s3 sync s3://my-bucket s3://my-other-bucket \
            --exclude 'customers/*' \
            --exclude 'orders/*' \
            --exclude 'reportTemplate/*'

提示

:您必须将通配符和特殊字符放在单引号或双引号中才能正常工作。下面是匹配字符的示例。有关S3命令的更多信息,请查看

亚马逊在这里

..。

代码语言:javascript
运行
复制
*: Matches everything
?: Matches any single character
[sequence]: Matches any character in sequence
[!sequence]: Matches any character not in sequence
票数 120
EN

Stack Overflow用户

发布于 2018-09-29 00:40:10

对于要同步存储桶中的某个子文件夹的用户,排除筛选器将应用于正在同步的文件夹内的文件和文件夹,而不是存储桶的路径,例如:

代码语言:javascript
运行
复制
aws s3 sync s3://bucket1/bootstrap/ s3://bucket2/bootstrap --exclude '*' --include 'css/*'

将同步以下文件夹树中的文件夹bootstrap/css,但不同步bootstrap/js和bootstrap/fonts:

代码语言:javascript
运行
复制
bootstrap/
├── css/
│   ├── bootstrap.css
│   ├── bootstrap.min.css
│   ├── bootstrap-theme.css
│   └── bootstrap-theme.min.css
├── js/
│   ├── bootstrap.js
│   └── bootstrap.min.js
└── fonts/
    ├── glyphicons-halflings-regular.eot
    ├── glyphicons-halflings-regular.svg
    ├── glyphicons-halflings-regular.ttf
    └── glyphicons-halflings-regular.woff

也就是说,过滤器是'css/

*

‘而不是'bootstrap/css/

*

更多信息

https://docs.aws.amazon.com/cli/latest/reference/s3/index.html#use-of-exclude-and-include-filters

票数 17
EN

Stack Overflow用户

发布于 2020-04-29 10:22:37

在Windows命令提示符下,只有双引号有效,因此请在通配符前后使用“”,例如:

代码语言:javascript
运行
复制
aws s3 sync  s3://bucket-1/ . --exclude "reportTemplate/*" --exclude "orders/*"

单引号在Windows10上不起作用(使用--dryrun选项进行了测试)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32393026

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档