Align and test handling of directories in S3_File
#9704
Labels
-libs
Libraries: New libraries to be implemented
l-writedata
x-new-feature
Type: new feature request
All of our file APIs have a
create_directory
method, except forS3_File
.This is not surprising, because S3 does not really have a concept of directories like most filesystems. Just creating a file with path
a/b/c/f.txt
makes directoriesa/
,a/b/
anda/b/c/
existent.The AWS Console is using a 'trick' to be able to create an empty directory. To create a directory
a/b/c/
it creates an empty object with keya/b/c/
(with the trailing slash) to indicate the directory exists. We can likely replicate this behaviour as well.All operations should still work without having to explicitly create the parent directories, like one would need to in regular filesystems. The user should not need to care about these with S3, but at the same time if the user wants to explicitly create an empty directory - that should also be possible with the trick mentioned above.
create_directory
method toS3_File
.self.is_directory
is true. For patha/b/c/
it should only create one keya/b/c/
, it should not create additional keys along the path - e.g.a/b/
- these directories will start to exist 'virtually' by the fact of the child key existing.create_directory
, it should yieldexists == True
.exists == True
even if not explicitly created.S3_File.list
.delete
d.delete
d.delete
withrecursive
flag, consistent with local and Cloud variants.delete recursive=False
should fail if there are any files or subdirectories inside of a given directory, but should succeed if the directory is empty and exists only because it was explicitly created withcreate_directory
.delete recursive=True
should always delete the directory entry (if it exists) and any files inside of it.The text was updated successfully, but these errors were encountered: