From 1795e0e9dd268da8057adbaa7184440dd78d1047 Mon Sep 17 00:00:00 2001 From: Thayne McCombs Date: Tue, 10 Aug 2021 00:42:53 -0600 Subject: [PATCH] Add documentation and examples of ** in glob mode And how it should be used with the `--full-path` option. Fixes #764. --- README.md | 9 +++++++++ doc/fd.1 | 1 + 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index 91db1a7..22361cb 100644 --- a/README.md +++ b/README.md @@ -145,6 +145,15 @@ target/debug/deps/libnum_cpus-f5ce7ef99006aa05.rlib To really search *all* files and directories, simply combine the hidden and ignore features to show everything (`-HI`). +### Matching the full path +By default, *fd* only matches the filename of each file. However, using the `--full-path` or `-p` option, +you can match against the full path. + +```bash +> fd -p -g '**/.git/config' +> fd -p '.*/lesson-\d+/[a-z]+.(jpg|png)' +``` + ### Command execution Instead of just showing the search results, you often want to *do something* with them. `fd` diff --git a/doc/fd.1 b/doc/fd.1 index 94feaa1..3dfec2e 100644 --- a/doc/fd.1 +++ b/doc/fd.1 @@ -55,6 +55,7 @@ pattern contains an uppercase character (smart case). .TP .B \-g, \-\-glob Perform a glob-based search instead of a regular expression search. +If combined with the '\-\-full-path' option, '**' can be used to match multiple path components. .TP .B \-\-regex Perform a regular-expression based search (default). This can be used to override --glob.