Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ Options:
-t, --type <filetype> 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 <ext> Filter by file extension
-e, --extension <ext> Filter by extension
-S, --size <size> Limit results based on the size of files
--changed-within <date|dur> Filter by file modification time (newer than)
--changed-before <date|dur> Filter by file modification time (older than)
Expand Down
6 changes: 4 additions & 2 deletions doc/fd.1
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 4 additions & 3 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,16 +364,17 @@ pub struct Opts {
)]
pub filetype: Option<Vec<FileType>>,

/// (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.
#[arg(
long = "extension",
short = 'e',
value_name = "ext",
help = "Filter by file extension",
help = "Filter by extension",
long_help
)]
pub extensions: Option<Vec<String>>,
Expand Down