https://github.com/mantono/fwalker
File walker library crate for Rust
https://github.com/mantono/fwalker
crate file-traversal files filesystem library rust
Last synced: 11 months ago
JSON representation
File walker library crate for Rust
- Host: GitHub
- URL: https://github.com/mantono/fwalker
- Owner: mantono
- License: mit
- Created: 2020-03-16T21:34:41.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-06-21T22:41:29.000Z (about 3 years ago)
- Last Synced: 2025-07-24T15:04:56.074Z (11 months ago)
- Topics: crate, file-traversal, files, filesystem, library, rust
- Language: Rust
- Size: 163 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fwalker:walking:
A cargo crate for file and directory traversal in a file system through an iterator


[](LICENSE)
## Documentation
See [docs.rs/fwalker](https://docs.rs/fwalker/) for complete documentation and more advanced usage.
## Usage
Add crate to Cargo.toml to use it
```toml
[dependencies]
fwalker = "0.4.1"
```
This crate has only one public struct, `fwalker::Walker`. With this struct, files and directories
can be iterated over for any kind of listing, manipulation or processing. Creating a new walker can
be done with either
- `fwalker::Walker::new()` - starts from current directory
- `fwalker::Walker::from("/some/path")` - starts from path `/some/path`
Quick example to get you started
```rust
use fwalker::Walker;
use std::path::PathBuf;
fn main() {
Walker::from("/proc/sys")
.expect("This *should* work")
.take(10)
.for_each(|file: PathBuf| println!("{:?}", file));
}
```
which would yield the output
```
"/proc/sys/abi/vsyscall32"
"/proc/sys/debug/exception-trace"
"/proc/sys/debug/kprobes-optimization"
"/proc/sys/fs/aio-max-nr"
"/proc/sys/fs/aio-nr"
"/proc/sys/fs/dentry-state"
"/proc/sys/fs/dir-notify-enable"
"/proc/sys/fs/file-max"
"/proc/sys/fs/file-nr"
"/proc/sys/fs/inode-nr"
```
See also example in [examples](examples/) directory.