Skip to content

fs.glob("/dir/**/*") is inconsitent with glob.glob #1394

@alanhdu

Description

@alanhdu

If you run the following code:

import fsspec

fs, __ = fsspec.core.url_to_fs("memory://")
fs.touch("/a/1")
fs.touch("/a/2")
fs.touch("/a/b/1")
fs.touch("/a/b/2")

print(fs.glob("/a/**/*"))

you will get different ansewrs -- on fsspec 2023.5, you get ['/a/b/1', '/a/b/2'] but in fsspec 2023.9 you get ['/a/1', '/a/2', '/a/b', '/a/b/1', '/a/b/2'].

I believe the 2023.5 behavior is more consistent with how Python's glob.glob works, but don't have a strong opinion.

I believe this separate from #1380, since this has to do with the behavior of /dir/**/*, not the behavior of **/, but happy to be corrected!

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