https://github.com/razerm/crabwalk
Fast recursive directory iterator which supports .gitignore files, file types, and glob filtering.
https://github.com/razerm/crabwalk
Last synced: 3 months ago
JSON representation
Fast recursive directory iterator which supports .gitignore files, file types, and glob filtering.
- Host: GitHub
- URL: https://github.com/razerm/crabwalk
- Owner: RazerM
- License: other
- Created: 2022-12-04T00:59:59.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-22T14:47:54.000Z (5 months ago)
- Last Synced: 2025-01-29T15:35:14.044Z (4 months ago)
- Language: Rust
- Size: 200 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# crabwalk
crabwalk is a Python package built in Rust on top of the excellent [ignore][] crate:
> The ignore crate provides a fast recursive directory iterator that respects
> various filters such as globs, file types and .gitignore files.[ignore]: https://github.com/BurntSushi/ripgrep/tree/master/crates/ignore
## Examples
### Defaults
By default, `Walk` will recursively traverse the given path(s) while ignoring
hidden files and those matching globs found in `.gitignore` and `.ignore` files:```python
from crabwalk import Walkwith Walk(".") as walk:
for entry in walk:
print(entry.path)
```### Disable standard filters
To disable all default filtering (and therefore behave more like `os.walk`),
you can set the corresponding flags individually or use the helper method shown
here:```python
from crabwalk import Walkwith Walk(".") as walk:
walk.disable_standard_filters()
for entry in walk:
print(entry.path)
```### Advanced
Disable the hidden files filter and enable parsing of custom ignore files called
`.myignore`:```python
from crabwalk import Walkwith Walk(".", hidden=False, custom_ignore_filenames=(".myignore",)) as walk:
for entry in walk:
print(entry.path)
```See the documentation for all options.