Skip to content

Latest commit

 

History

History
64 lines (48 loc) · 1.33 KB

README.md

File metadata and controls

64 lines (48 loc) · 1.33 KB

rfind

A command-line tool that searches for files in reverse order (i.e. to ancestor direction).

The result of the found files' paths ensures that they are ordered by the length of the match, with longer matches appearing first.

Usage

Usage:
  rfind [OPTIONS] ORIGIN_PATH TARGETS...
Options:
  -dir-only
        Find only directory
  -file-only
        Find only file
  -limit uint
        Limit the number of found items (default: unlimited)
  -max-depth-from-root uint
        Max number of path depth to search from root (default: unlimited)
  -max-upper-depth uint
        Max number of path depth to search from the ORIGIN_PATH to ancestor direction (default: unlimited)

Examples

When the directory structure is as follows:

/
├── bar
├── buz
│    ├── qux
│    │    └── target.txt
│    └── target.txt
├── foo
│    └── target.txt
└── target.txt

And the current directory is /buz/qux, the following command will find target.txt in the ancestor directories:

$ rfind . target.txt # `rfind /buz/qux target.txt` also works as well
/buz/qux/target.txt
/buz/target.txt
/target.txt

And the targets can be accepted the multi leaved paths:

$ rfind /buz/qux foo/target.txt
/foo/target.txt

Author

moznion ([email protected])

License

MIT