#search-pattern #pattern #find #command-line-tool #command-line #tool #search

bin+lib finr

finr recursively searches files and directories with a pattern while ignoring irrelevant directories. Built with the phrase "Work smarter not harder" in mind

5 releases

0.2.3 Jun 22, 2023
0.2.0 Jun 10, 2023
0.1.2 Jun 7, 2023
0.1.1 Jun 7, 2023
0.1.0 Jun 6, 2023

#1009 in Development tools

44 downloads per month

MIT license

77KB
255 lines

Finr

Recursively search for files and directories with a pattern, ignoring irrelevant directories.

Table of contents

Comparing finr and and fd-find

finr benchmark

Motivation

I developed finr to quickly find files and directories in the filesystem, ignoring certain directories that usually do not contain what I'm looking for. Finr is heavily inspired by ripgrep, specifically the ignore directories part. I wanted a tool that was both fast and easy to use.

Installation

Assumes that you have rust and cargo installed.

cargo install finr

Build from source

git clone https://github.com/Gers2017/finr && \
cd finr && \
cargo build --release

Usage

Print help message

finr --help

Finr looks for files and starts at the current directory by default. To search for a directory, use -t d (--type directory). The max-depth is arbitrarily set to 100.

Search for .rs files using regex (Uses the regex crate)

finr '.+\.rs$' --regex

finr searching for .md files with a max depth of 200

finr '.+\.md$' --regex --max-depth 200

Search for directories that start with build inside the Documents directory. (Uses starts_with)

finr build ~/Documents --start -t d

Search for files with .rs. Starting at the current directory. (Uses ends_with)

finr .rs -e

Searching for files that contain main in the name, starting at Documents. (Uses contains)

finr main ~/Documents/

Search for directories that contain _node_modules_ in the name.

finr node_modules -t d

Search for files with .rs at the end, starting at the /home/ directory while excluding (-E) some directories.

finr .rs ~/ -e -E Files Videos Downloads .config .local

Search for files that contain main.c starting at the current directory. Ignoring Music Videos Downloads and Including .config .local .ignore.

finr main.c --exclude Music Videos Downloads --include .config .local .ignore

What about find or fd-find?

I consider both find and fd to be a great tools with more features than finr. Since finr is relatively new, it doesn't have as many features as either find or fd-find (so please bear this in mind).

Similar tools

Dependencies

~2.4–3.5MB
~58K SLoC