亚马逊S3的球形图案 [英] Glob pattern with amazon s3

查看:102
本文介绍了亚马逊S3的球形图案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将文件从一个s3存储桶移动到另一个s3存储桶.我只想移动名称以"part"开头的文件.我可以使用java来实现.但是可以使用Amazon CLI来实现.我们可以在CLI中使用GlobPattern吗? 我的对象名称如下: part0000 part0001

I want to move files from one s3 bucket to another s3 bucket.I want to move only files whose name starts with "part".I can do it by using java.But is it possible to do it with amazon CLI. Can we use GlobPattern in CLI. my object name are like: part0000 part0001

推荐答案

是的,可以使用--include--exclude选项通过aws CLI实现.

Yes, this is possible through the aws CLI, using the --include and --exclude options.

作为示例,您可以使用aws s3 sync命令来同步零件文件:

As an example, you can use the aws s3 sync command to sync your part files:

aws s3 sync --exclude '*' --include 'part*' s3://my-amazing-bucket/ s3://my-other-bucket/

您还可以使用带有--recursive标志的cp命令:

You can also use the cp command, with the --recursive flag:

aws s3 cp --recursive --exclude '*' --include 'part*' s3://my-amazing-bucket/ s3://my-other-bucket/

说明:

  • aws:aws CLI命令
  • s3:要与之交互的aws服务
  • sync:对服务执行的命令
  • --exclude <value>:要被忽略的UNIX风格的通配符,除非包含语句
  • --include <value>:要操作的UNIX样式的通配符.
  • aws: The aws CLI command
  • s3: The aws service to interface with
  • sync: The command to the service to do
  • --exclude <value>: The UNIX-style wildcard to ignore, except by include statements
  • --include <value>: The UNIX-style wildcard to act upon.

文档,您也可以多次指定--include--exclude.

As noted in the documentation, you can also specify --include and --exclude multiple times.

这篇关于亚马逊S3的球形图案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆