diff --git a/README.md b/README.md index 18a56d529..a4e6a41bf 100644 --- a/README.md +++ b/README.md @@ -328,7 +328,7 @@ Options: -t, --type Filter by type: file (f), directory (d/dir), symlink (l), executable (x), empty (e), socket (s), pipe (p), char-device (c), block-device (b) - -e, --extension Filter by file extension + -e, --extension Filter by extension -S, --size Limit results based on the size of files --changed-within Filter by file modification time (newer than) --changed-before Filter by file modification time (older than) diff --git a/doc/fd.1 b/doc/fd.1 index aa167b89f..078b42d79 100644 --- a/doc/fd.1 +++ b/doc/fd.1 @@ -250,9 +250,11 @@ Examples: .RE .TP .BI "\-e, \-\-extension " ext -Filter search results by file extension +Filter search results by extension .IR ext . -This option can be used repeatedly to allow for multiple possible file extensions. +This option can be used repeatedly to allow for multiple possible extensions. +By default, extension filters apply to both files and directories. Use +\fB\-\-type\fR to restrict the search to specific types. If you want to search for files without extension, you can use the regex '^[^.]+$' as a normal search pattern. diff --git a/src/cli.rs b/src/cli.rs index 9c54d7c2c..184e75f29 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -364,8 +364,9 @@ pub struct Opts { )] pub filetype: Option>, - /// (Additionally) filter search results by their file extension. Multiple - /// allowable file extensions can be specified. + /// Filter results by extension. By default, this matches all entry types + /// (including directories whose names end with the extension). Use `--type` + /// to restrict the search to specific types. Multiple extensions can be specified. /// /// If you want to search for files without extension, /// you can use the regex '^[^.]+$' as a normal search pattern. @@ -373,7 +374,7 @@ pub struct Opts { long = "extension", short = 'e', value_name = "ext", - help = "Filter by file extension", + help = "Filter by extension", long_help )] pub extensions: Option>,