如何在使用亚马逊网络服务s3 syn时排除多个文件夹?
我试过了:
# aws s3 sync s3://inksedge-app-file-storage-bucket-prod-env s3://inksedge-app-file-storage-bucket-test-env --exclude 'reportTemplate/* orders/* customers/*'
但它仍然在同步文件夹"customer“
输出:
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
发布于 2015-09-04 17:35:09
最后,这对我起作用了:
aws s3 sync s3://my-bucket s3://my-other-bucket \
--exclude 'customers/*' \
--exclude 'orders/*' \
--exclude 'reportTemplate/*'
提示
:您必须将通配符和特殊字符放在单引号或双引号中才能正常工作。下面是匹配字符的示例。有关S3命令的更多信息,请查看
亚马逊在这里
..。
*: Matches everything
?: Matches any single character
[sequence]: Matches any character in sequence
[!sequence]: Matches any character not in sequence
发布于 2018-09-29 00:40:10
对于要同步存储桶中的某个子文件夹的用户,排除筛选器将应用于正在同步的文件夹内的文件和文件夹,而不是存储桶的路径,例如:
aws s3 sync s3://bucket1/bootstrap/ s3://bucket2/bootstrap --exclude '*' --include 'css/*'
将同步以下文件夹树中的文件夹bootstrap/css,但不同步bootstrap/js和bootstrap/fonts:
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
发布于 2020-04-29 10:22:37
在Windows命令提示符下,只有双引号有效,因此请在通配符前后使用“”,例如:
aws s3 sync s3://bucket-1/ . --exclude "reportTemplate/*" --exclude "orders/*"
单引号在Windows10上不起作用(使用--dryrun选项进行了测试)。
https://stackoverflow.com/questions/32393026
复制相似问题