#regex #scanner #file #file-search #search

bin+lib scanit

A fast file scanner utility that uses regex patterns to find files in your filesystem

9 releases

new 0.3.2 Jan 29, 2025
0.3.1 Jan 29, 2025
0.2.5 Jan 9, 2025
0.2.1 Dec 28, 2024
0.1.178 Dec 21, 2024

#257 in Filesystem

Download history 611/week @ 2024-12-18 537/week @ 2024-12-25 4/week @ 2025-01-01 132/week @ 2025-01-08

682 downloads per month

MIT license

11KB
102 lines

scanit 🔍

Rust License: 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

cargo install scanit

📝 Changelog

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

Dependency Version Description
regex 1.11.1 Regular expression pattern matching
clap 4.4 Command line argument parsing
jwalk 0.8.1 Fast parallel directory traversal

Special thanks to:

jwalk - 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$' -d /usr

Find PNG files from current directory

scanit '.png$' -c

(or equivalently, scanit '.png$' --current-directory)

Find JavaScript test files

scanit '^/.test..js$'

Find hidden git files

scanit -a '.git'

Search all dirs and file names for a pattern eg zshrc

scanit zshrc -a -i

(or equivalently, scanit zshrc --show-hidden --include-dirs)

Search case insensitively

scanit PYTHON -e
(or equivalently, --case-insensitive) (e is for everything)

Usage Instructions

Usage: scanit [OPTIONS]

Arguments: Regex pattern to match files (e.g. \.rs$)

Options

Option Description Default
-d, --directory <DIR> Starting directory / (Unix), C:/ (Windows)
-c, --current-directory Use current directory -
-a, --show-hidden Show hidden files -
-h, --help Show help -
-v, --version Show version -
-i, --include-dirs Include directories in search pattern -
-e, --case-insensitive Does case insensitive searching defaults to on

Dependencies

~4.5–6MB
~110K SLoC