Skip to content
asyntsPublic

About

a command to locate a file in a directory

Topics

Resources

Stars

2 stars

Watchers

2 watching

Forks

Latest commit

 

History

45 Commits

Folders and files

Repository files navigation

finder

This is essentially locate from findutils but for local directories.

The program recursivly searches for files and builds a database which can be queried for filenames.

Usage

usage: finder [OPTIONS] [FILENAME]
OPTIONS
        --help          display usage information
        --version       display version information
    -r, --rebuild       rebuild cache
    -l, --list          list all filepaths from the cache

Examples

Finder can be used to locate all filepaths in a directory that have the same filename:

$ mkdir -p a/b/c
$ touch foo.txt a/bar.txt a/b/foo.txt a/b/c/bar.txt
$ finder --rebuild                                      # rebuild the cache
$ finder foo.txt                                        # search for 'foo.txt'
./foo.txt
./a/b/foo.txt
$ finder --list                                         # list all cached files
./foo.txt
./a/bar.txt
./a/b/foo.txt
./a/b/c/bar.txt
$ touch bar.txt
$ finder --list                                         # finder doesn't know about './bar.txt'
./foo.txt                                               # until the cache is rebuild
./a/bar.txt
./a/b/foo.txt
./a/b/c/bar.txt

The --list option can be used with grep or other utilities to search for more complex patterns:

$ mkdir -p a/b/c
$ touch foo.txt a/bar.txt a/b/foo.png
$ finder --rebuild --list | grep '.txt$'                 # find all the files that have the file
./foo.txt                                                # extension '.txt'
./a/bar.txt

About

a command to locate a file in a directory

Topics

Resources

Stars

2 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages