https://github.com/brglng/bfind
find in breadth-first order
https://github.com/brglng/bfind
rust
Last synced: 2 months ago
JSON representation
find in breadth-first order
- Host: GitHub
- URL: https://github.com/brglng/bfind
- Owner: brglng
- License: apache-2.0
- Created: 2017-08-08T06:47:20.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2025-02-25T05:51:26.000Z (4 months ago)
- Last Synced: 2025-04-10T01:06:26.550Z (2 months ago)
- Topics: rust
- Language: Rust
- Homepage:
- Size: 54.7 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bfind

A [GNU Find](https://www.gnu.org/software/findutils/)-like tool, but uses breadth-first search instead of depth-first search, written in [Rust](https://www.rust-lang.org/).
## Why
* BFS prefers files that are shallower, which means files in shallower directories are more likely to be found in a shorter time.
* When encountering a subdirectory which has many very deep subdirectories, BFS doesn't stuck on it before moving to the next subdirectory.
* I want to learn Rust by making this tool.**NO WARRANTY:** I make this tool mainly for my personal use. I have no plan to improve its performance or features, neither are issues guaranteed to get fixed. However, PR is welcome.
## Build
```sh
$ cargo build
```Or for the release version
```sh
$ cargo build --release
```## Install
```sh
$ cargo install --path .
```## Usage
**NOTE: Currently, only basic directory listing is implemented.**
List current working directory:
```sh
$ bfind
```List a specific directory:
```sh
$ bfind /path/to/directory
```Find a file with regular expression:
```sh
$ bfind . -- name match 'foo.*'
```Find a file with glob:
```sh
$ bfind . -- name glob 'foo*'
```Combining conditions:
```sh
$ bfind . -- name glob 'foo*' and type is dir
```Print with formatting:
```sh
$ bfind . print 'file: {name:10}, {size:>10} bytes' -- name glob 'foo*' and size gt 1MiB
```Execute a command:
```sh
$ bfind . exec cat '{fullpath}' -- name glob 'foo*.txt'
```## TODO
- Design a simple and powerful command line syntax.
- Implement the command line interface.