8000 Update mkdir to behave like creating a directory in the console · Issue #202 · liormizr/s3path · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Update mkdir to behave like creating a directory in the console #202
Open
@Alexndrrr

Description

@Alexndrrr

While the docstring for mkdir is correct that S3 doesn't have folders, the s3 console still gives you the "illusion" of directories implied by slashes in object keys. It also lets you create "directories" which are just 0 byte objects with keys ending with a slash, and I have some use cases that use these. It's not possible as far as I can tell to create these with S3Path because the pathlib API strips trailing slashes.

I propose we enhance the mkdir function to create an empty object named with a trailing slash.

For example, S3Path('/some-bucket/some-directory').mkdir() creates an object in bucket some-bucket and key some-directory/.

Setting parents=True would create the bucket first if necessary.

I don't think it's necessary for mkdir to also create parent directories (i.e. it's not required for the s3 console to see directories) but for consistency, I think it could be argued that they should be created anyway for the sake of consistency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0