Skip to content

glob is not reporting empty folders #908

@NicholasFiorentini

Description

@NicholasFiorentini

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,

>>> import s3fs
>>> s3 = s3fs.S3FileSystem(anon=False)
>>> s3.glob("s3://my-test-bucket/20241030-tests/**/*")
['my-test-bucket/20241030-tests/non-empty', 'my-test-bucket/20241030-tests/non-empty/timsdevel-test-folders.pdf']

Notice that:

>>> s3.ls("s3://my-test-bucket/20241030-tests/")
['my-test-bucket/20241030-tests/', 'my-test-bucket/20241030-tests/empty', 'my-test-bucket/20241030-tests/non-empty']

Information

  • Python 3.10.13
  • s3fs version 2024.10.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions