Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

How can I create a folder under a bucket using boto library for Amazon s3?

I followed the manual and created the keys with permission, metadata etc, but nowhere in the boto's documentation it describes how to create folders under a bucket, or create a folder under folders in the bucket.

closed

1 Answer

0 votes
by (44.4k points)
selected by
 
Best answer

There is no concept of folders or directories. Multiple files following a path make it look like they are files inside that particular folder. But actually, they are not folders. Like “/a/b/c/hello.png” is just a single file rather than inside a folder. But if you want to create a path, which you consider as a file, you can use boto like this (for creating aaa/bbb):

k = bucket.new_key(‘aaa/bbb’')

k.set_contents_from_string('')

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...