-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
glob is not reporting empty folders #908
Comments
The following test passes - am I understanding your situation incorrectly? def test_glob_empty_folder(s3):
s3.touch(f"{test_bucket_name}/glob/empty/")
s3.touch(f"{test_bucket_name}/glob/not_empty/")
s3.touch(f"{test_bucket_name}/glob/not_empty/file")
out = s3.glob(f"{test_bucket_name}/glob/**/*")
assert out == ['test/glob/empty', 'test/glob/not_empty', 'test/glob/not_empty/file'] |
I wonder if |
I believe create-folder makes a zero-length file with "/" on the end; but it's possible (I can check) that |
Thanks, I'll also have a look tomorrow to ensure you can replicate. |
Indeed, if I change it to the following, it fails - so this is the reproducer to fix. def test_glob_empty_folder(s3):
s3.call_s3("put_object", Bucket=test_bucket_name, Key="glob/empty/")
s3.touch(f"{test_bucket_name}/glob/not_empty/")
s3.touch(f"{test_bucket_name}/glob/not_empty/file")
out = s3.glob(f"{test_bucket_name}/glob/**/*")
assert out == ['test/glob/empty', 'test/glob/not_empty', 'test/glob/not_empty/file'] |
The output of
so, the question is: does really "test/glob/**/*" match "test/glob/empty/" ? |
The folder is matched when using the >>> list(Path(".").glob("test/**/*"))
[PosixPath('test/file.txt'), PosixPath('test/nonempty'), PosixPath('test/empty'), PosixPath('test/nonempty/file.txt')] With the following folder structure:
|
When using
S3FileSystem.glob
pattern, empty folders aren't reported.Expected Behaviour
The empty folders must be reported. Those "folders" are indeed listed by
S3FileSystem.ls
.How to Reproduce
From the bucket's AWS S3 Console create an empty folder (
create folder
button) and a non-empty folder (a folder with a proper non-empty file).Then,
Notice that:
Information
3.10.13
s3fs
version2024.10.0
The text was updated successfully, but these errors were encountered: