#regex #directory #search #version #find #multi-threaded #file

bin+lib scanit

A fast, multi-threaded filesystem search tool

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

#458 in Filesystem

Download history 445/week @ 2024-12-15 597/week @ 2024-12-22 109/week @ 2024-12-29 118/week @ 2025-01-05 15/week @ 2025-01-12 288/week @ 2025-01-26

422 downloads per month

MIT license

14KB
233 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.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

Dependency Version Description
regex 1.11.1 Regular expression pattern matching
clap 4.5.27 Command line argument parsing
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

Argument Description
PATTERN Regex pattern to match against filenames
DIRECTORY Path to search (defaults to / on Unix systems or C:/ on Windows)

Options

Option Description Default
-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.

Dependencies

~5–13MB
~154K SLoC