Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
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.3k 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
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...