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.
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.
How do tools such as cyberduck give a list of folders so quickly?
Check this link: http://docs.aws.amazon.com/AmazonS3/latest/dev/ListingKeysHierarchy.html
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.