0 votes
1 view
in AWS by (19.2k 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.

1 Answer

0 votes
by (44.6k 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

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...