根据名称快速查找文件 (ff)
Find Files (ff) utility recursively searches the files whose names match the specified RegExp pattern in the provided directory (defaults to the current directory if not provided).
Dual-licensed under MIT or the UNLICENSE.
There are various ways to install ff on your system.
If you use macOS, install ff simply using brew install vishaltelangre/tap/ff.
Download the latest precompiled executable ff binary for your platform from the releases page.
If you're a Rust programmer, download and install ff command using cargo install find-files. To update to a newer version, use the --force flag.
…| Command | Mean [ms] | Min…Max [ms] |
|---|---|---|
find . -iregex '.*[0-9]\.jpg$' |
42.8 ± 5.5 | 31.2…56.9 |
find . -iname '*[0-9].jpg' |
60.8 ± 7.2 | 44.0…76.2 |
fd -HI '.*[0-9]\.jpg$' |
18.8 ± 5.3 | 11.2…41.6 |
ff .*[0-9]\.jpg$ |
18.7 ± 4.6 | 11.7…30.4 |
Table: benchmark-results.md
NOTE: Sometimes, fd is a bit faster than ff by approximately 1 ms to 2 ms.
…There are a tons of possibilities to search files using ff.
Following examples demonstrate just a tip of an iceberg.
List paths of files recursively in the current working directory matching article string.
ff articleList files having .png, or .PNG extension.
ff png$List files having strict .PNG extension.
ff -s PNG$Search various image files.
ff "\.(png|jpg|jpeg|gif|svg)$"List files whose path matches controllers string.
ff controllersSearch .js files in ./spec directory.
ff \.js ./specSearch a file which is expected to be inside hidden .git directory whose name contains commit or something similar.
$ ff git.*commit
./.git/COMMIT_EDITMSG
# omitted other resultsDo not show hidden files and directories in the search results.
ff something -HDo not show those files and directories in the search results which are enlisted in .gitignore.
ff src/.*js$ -G Without -G (--ignore-gitignore) flag in the above command, it also includes the results in the directories such as node_modules by default.
Do not show paths which are just directories and not actual files.
$ ff -D user
./app/models/user.rb
./app/models/user/address.rb
./specs/models/user_spec.rb
./specs/models/user/address_spec.rb Without -D (--exclude-dir-paths) flag in the above command, it also includes the paths of the matching directories in the results as follows.
$ ff user
./app/models/user.rb
./app/models/user
./app/models/user/address.rb
./specs/models/user_spec.rb
./specs/models/user
./specs/models/user/address_spec.rbExclude (omit) files and directories which match the provided optional exclude RegExp pattern.
ff rb$ app/controllers -x /(audit|admin|sso|api)/ Above command will show paths of all files whose name ends with rb inside the relative app/controllers directory excluding the paths which match /(audit|admin|sso|api)/ pattern.
Limit searching beyond 3 levels deep in the given path.
ff -L 3 .js$暂无开放 Issues,或尚未同步最近议题。