You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dirs(path='/', **kwargs)
Walk a filesystem, yielding ABSOLUTE paths to directories.
and
filter_dirs(list, optional) – A list of patterns that will be used to match directories PATHS. The walk will only open directories that match at least one of these patterns.
This gives me the impression that the filters are applied to the absolute paths.
While in fact, if I understood and investigated correctly, these patterns match the directory NAMES. Here's an example to show that behavior:
Not a reply as to your remark (I agree its a bit limited in use), but I've been banging my head against the same problem.
The only solution I see (to work around it) is to implement a derived Walker class. If it overrides the "check_open_dir" function (or check_scan_dir which is called right after) and returns False, the directory will be skipped.
Both functions receive the path and the Info for the directory about to be opened/scanned.
It's a bit more work but the only one I can see
(You can specify the Walker class to use by using a BoundWalker)
Talking about https://docs.pyfilesystem.org/en/latest/reference/walk.html#fs.walk.BoundWalker.dirs and maybe
walk.files
is affected as well.The documentation talks about (emphasis by me):
and
This gives me the impression that the filters are applied to the absolute paths.
While in fact, if I understood and investigated correctly, these patterns match the directory NAMES. Here's an example to show that behavior:
Actual output:
Expected output:
This is probably not a bug in the code. However, the documentation is misleading and my question would be how I can get to my desired behavior.
The text was updated successfully, but these errors were encountered: