# scanit 🔍
[](https://www.rust-lang.org/)
[](https://opensource.org/licenses/MIT)
A command-line utility that recursively searches directories for files matching regex patterns.
Notably this is my first RUST cli and first time using git
## 🚀 Features
- Unix and Windows Compatible
- Recursive directory scanning
- Regex pattern matching
- Hidden file support
- Cross-platform compatibility (Unix and Windows)
- Current directory search option
## ⚙️ Installation
```bash
cargo install scanit
```
## 📝 Changelog
### Version=[0.3.0]
It should be a lot faster now!
Changed main directory traversing library to ignore.
Simplified CLI arguments for directory to eg scanit \.py$ [DIRECTORY] (defaults to root)
I have not investigate how it works on Windows for this release yet!
### version=[0.2.5]
Changed underlying structure to better enable use as a library.
Mostly, this means that now the find files returns an Iterator, which allows the collect method(or iteration)
Added a case-insensitivity option.
Increased performance again, roughly about 30% on my limited tests
Lowered Rust Version required to 1.74.1 for people on older Rust versions.
### version=[0.2.1]
#### Changes
- Fixed working directory commandline options
### version=[0.2.0]
#### Fixed
- Reduced redundant conversion errors when scanning restricted paths
- Improved error handling for kernel-protected directories
- Optimized path traversal logic
- Fixed README.md
- Added new CLI argument for including dirs in searching, defaults to off
#### Changed
- Improved performance when handling permission denied errors
## 🔧 Dependencies
| [regex](https://crates.io/crates/regex) | 1.11.1 | Regular expression pattern matching |
| [clap](https://crates.io/crates/clap) | 4.5.27 | Command line argument parsing |
| [ignore](https://crates.io/crates/ignore) | 0.4.23 | Fast parallel directory traversal |
Special thanks to:
ignore - For the excellent parallel directory traversal
regex - For the powerful regex engine
clap - For the robust CLI argument parsing
## Examples
## Find Rust files in /usr
scanit '\.rs$' /usr
## Find everything on your PC
scanit . -a -i -s # . = pattern, -a = --show-hidden, -i = --include-dirs, -s = --sys-paths
## Find PNG files from current directory
scanit '\.png$' -c # -c = --current-directory
## Find JavaScript test files starting from root
scanit '^/.*test.*\.js$'
## Find hidden git files
scanit -a '\.git'
## Search all dirs and file names for a pattern
scanit zshrc -a -i # -i = --include-directories
## Search case insensitively
scanit PYTHON -e # -e = --case-insensitive (e is short for everything and I didn't want to change my current directory argument!)
## Usage Instructions
Usage: scanit [OPTIONS] [PATTERN] [DIRECTORY]
Note: Options can go before or after arguments.
### Arguments
| PATTERN | Regex pattern to match against filenames |
| DIRECTORY | Path to search (defaults to / on Unix systems or C:/ on Windows) |
### Options
| `-c, --current-directory` | Uses the current directory | - |
| `-a, --show-hidden` | Shows hidden files (e.g. .gitignore, .bashrc) | - |
| `-v, --version` | Show version number | - |
| `-e, --case-insensitive` | Enable case-insensitive matching | - |
| `-n, --num-threads <THREAD_NUM>` | Number of threads to use | 8 |
| `-i, --include-dirs` | Include directories in search results | - |
| `-s, --sys-paths` | Include system paths (/proc, /sys, /tmp, /run, /dev) | - |
| `-h, --help` | Print help information | - |
> Note: Use -h for a quick summary or --help for detailed information.