简体   繁体   English

删除S3文件夹时是否可以应用通配符模式

[英]Is it possible to apply wild card patterns while removing S3 folders

http://docs.aws.amazon.com/cli/latest/reference/s3/rm.html http://docs.aws.amazon.com/cli/latest/reference/s3/rm.html

s3://foo/2015-01-01/..
s3://foo/2015-01-02/..
s3://foo/2015-01-03/..
..
s3://foo/2016-01-01/..
s3://foo/2016-01-02/..
s3://foo/2016-01-03/..

In the above setup, I would like to apply wild card on my removals. 在以上设置中,我想对通配符应用通配符。

e.g. aws s3 rm s3://foo/2015* 
or
aws s3 rm s3://foo/2016-02-* 

I am unable to achieve this with the existing command, is it achievable since I have large number of files to delete and I would like to run commands in parallel for faster deletes. 我无法使用现有命令来实现此目的,因为我要删除的文件数量很多,并且我想并行运行命令以实现更快的删除,所以这是可以实现的。

You cannot use Unix-style wildcards in the path but you can use filters on the S3 rm request to replicate the wildcard functionality. 您不能在路径中使用Unix样式的通配符,但是可以在S3 rm请求上使用过滤器来复制通配符功能。 (See http://docs.aws.amazon.com/cli/latest/reference/s3/index.html#use-of-exclude-and-include-filters for examples.) (有关示例,请参见http://docs.aws.amazon.com/cli/latest/reference/s3/index.html#use-of-exclude-and-include-filters 。)

当前,在命令的路径参数中不支持使用UNIX样式通配符,但是可以使用--exclude "<value>"--include "<value>"参数来达到期望的结果:

aws s3 rm s3://foo/ --recursive --exclude "*" --include "2016-02-*" --dryrun

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM