更快的方法,使S3"文件夹层次"不是解析文件名? [英] Faster way to make S3 "folder hierarchy" than parsing of filenames?

查看:145
本文介绍了更快的方法,使S3"文件夹层次"不是解析文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打一个比较基本的工具,在S3浏览水桶作为文件层次结构,而不是文件名的简单与他们斜线列表。

I want to make a relatively basic tool to browse a bucket in S3 as a file hierarchy rather than simply a list of filenames with slashes in them.

目前,我使用博托取得水桶键名的列表,然后解析键名,使文件夹和文件的嵌套字典。但是,这一过程需要这么长时间!即使只是通过每个键搞定所有的更高层次的文件夹列表需要超过15分钟。

Currently, I am using boto to get the list of keynames in a bucket and then parsing the keynames to make a nested dictionary of the "folders" and files. However, that process takes so long! Even just going through each key to get a list of all higher level folders takes 15+ minutes.

如何如Cyber​​duck的工具给文件夹列表这么快?

How do tools such as cyberduck give a list of folders so quickly?

推荐答案

检查此链接: http://docs.aws.amazon.com/AmazonS3/latest/dev/ListingKeysHierarchy.html

listObjects()有一个名为参数分隔符,它可以设置为 / 和产生的对象列表看起来完全一样的文件树。我想这就是你要找的内容。

listObjects() has a parameter called delimiter, which could be set to / and resulting list of objects will look exactly as a tree of files. I think this is what you're looking for.

这篇关于更快的方法,使S3"文件夹层次"不是解析文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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