如何递归地从S3斗删除文件 [英] How to delete files recursively from an S3 bucket
本文介绍了如何递归地从S3斗删除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在S3中的以下文件夹结构。有没有一种方法来递归删除在特定的文件夹中的所有文件(比如富/ BAR1或富或富/ BAR2 / 1
..)
富/ BAR1 / 1 / ..
富/ BAR1 / 2 / ..
富/ BAR1 / 3 / ..
富/ BAR2 / 1 / ..
富/ BAR2 / 2 / ..
富/ BAR2 / 3 / ..
解决方案
随着最新 AWS-CLI巨蟒的命令行工具 ,递归删除一个桶中的所有文件就是:
AWS S3 RM --recursive S3:// your_bucket_name
如果你想要的是实际删除桶中,有一步到位的快捷方式:
AWS S3 RB --force S3:// your_bucket_name
这将删除的内容在斗recurisvely然后删除桶。
I have the following folder structure in S3. Is there a way to recursively remove all files under a certain folder (say foo/bar1 or foo or foo/bar2/1
..)
foo/bar1/1/..
foo/bar1/2/..
foo/bar1/3/..
foo/bar2/1/..
foo/bar2/2/..
foo/bar2/3/..
解决方案
With the latest aws-cli python command line tools, to recursively delete all the files in a bucket is just:
aws s3 rm --recursive s3://your_bucket_name
If what you want is to actually delete the bucket, there is one-step shortcut:
aws s3 rb --force s3://your_bucket_name
which will remove the contents in that bucket recurisvely then delete the bucket.
这篇关于如何递归地从S3斗删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文