Skip to content

Create folder using boto3 #3286

Answered by tim-finnigan
WilliamLoey asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @WilliamLoey thanks for reaching out. As described in this documentation S3 doesn’t technically have folders:

Amazon S3 has a flat structure instead of a hierarchy like you would see in a file system. However, for the sake of organizational simplicity, the Amazon S3 console supports the folder concept as a means of grouping objects.

But you could create that folder concept for grouping objects like this:

import boto3
client = boto3.client('s3')

client.put_object(
    Bucket='bucket-name',
    Key='test-folder/'
)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@WilliamLoey
Comment options

Answer selected by tim-finnigan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants