Gow*_*and 6 amazon-s3 amazon-web-services
我想将文件夹内的多个文件从 ec2 复制到 s3 存储桶。
\n\n文件夹结构是这样的,
\n\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80data\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80201707\n |\n |__ new\n |\n |__ new1\nRun Code Online (Sandbox Code Playgroud)\n\n我只想复制201707文件夹的内容,所以我使用了以下命令:
aws s3 cp data/ s3://bucket-name/data/201707/ --recursive --exclude 'data/new/*' --exclude 'data/new1/*'\nRun Code Online (Sandbox Code Playgroud)\n\n但是 s3 中的输出有一个 new 和 new1 文件夹,排除这些文件夹的正确命令是什么?
\naws-cli 子命令的--exclude和参数采用模式,而不仅仅是路径前缀。--includes3
--exclude (string) Exclude all files or objects from the command that matches the specified pattern.
Run Code Online (Sandbox Code Playgroud)
来源: https: //docs.aws.amazon.com/cli/latest/reference/s3/cp.html
The following pattern symbols are supported.
*: Matches everything
?: Matches any single character
[sequence]: Matches any character in sequence
[!sequence]: Matches any character not in sequence
Run Code Online (Sandbox Code Playgroud)
来源: https: //docs.aws.amazon.com/cli/latest/reference/s3/index.html#use-of-exclude-and-include-filters
根据您的示例,正确的调用应该是:
aws s3 cp data/ s3://bucket-name/data/201707/ --recursive --exclude 'data/new/*' --exclude 'data/new1/*'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
32588 次 |
| 最近记录: |