You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, fd offers the -t command line option to view only files of a single type (regular files, directories, symbolic links).
However, there is no way (that I can see) to view all files except those of a single type (in other words, to exclude a given filetype from the results). Perhaps a syntax like +td or -Td to exclude directories, or -tfl to do the same?
Hopefully, I've missed something, and this feature is already available!
Workaround
The best I can think to do is
$ rg -FNxvf <(fd -td) <(fd)
rg <(fd) searches the output of fd
-f <(fd -td) searches against patterns contained in the "file" <(fd -td) (the output of that command), rather than patterns given on the command line
-F treats search patterns as fixed strings (not regular expressions)
-x requires a whole like match (like wrapping each line in ^$)
-v inverts the results (gives non-matches, rather than matches).
-N suppresses line numbers
The text was updated successfully, but these errors were encountered:
Hopefully, I've missed something, and this feature is already available!
Unfortunately - no. However, consider the following:
▶ tree
.
├── dir
├── file
├── symlink_to_dir -> dir
└── symlink_to_file -> file
We can search for dir only (-td)
We can search for file only (-tf`)
We can search for both symlinks (-tl)
We can also search for dir and symlink_to_dir (-L -td)
as well as for file and symlink_to_file (-L -tf)
What is missing is:
search for dir and both symlinks
search for file and both symlinks
search for dir and file
For now, I would propose to allow for multiple occurrences of the --type/-t option in a union-like fashion ("or" instead of "and"). Since there are only three types of entries, I think this would still be acceptable (having to specify --type file --type directory instead of --exclude-type symlink).
I'm open for other ideas, though. What do you think?
For now, I would propose to allow for multiple occurrences of the --type/-t option in a union-like fashion ("or" instead of "and"). Since there are only three types of entries, I think this would still be acceptable (having to specify --type file --type directory instead of --exclude-type symlink).
Now there are 7+2 file types (the latter two being the executable and empty dir). A negated filetype seems like a reasonable addition now. Should I create a new issue for that?
Currently,
fd
offers the-t
command line option to view only files of a single type (regular files, directories, symbolic links).However, there is no way (that I can see) to view all files except those of a single type (in other words, to exclude a given filetype from the results). Perhaps a syntax like
+td
or-Td
to exclude directories, or-tfl
to do the same?Hopefully, I've missed something, and this feature is already available!
Workaround
The best I can think to do is
rg <(fd)
searches the output of fd-f <(fd -td)
searches against patterns contained in the "file" <(fd -td) (the output of that command), rather than patterns given on the command line-F
treats search patterns as fixed strings (not regular expressions)-x
requires a whole like match (like wrapping each line in ^$)-v
inverts the results (gives non-matches, rather than matches).-N
suppresses line numbersThe text was updated successfully, but these errors were encountered: