With zsh, you can use **/* as a short alternative to using find. Is there any way to restrict that to regular files, that is an equivalent to the -type f option?
Asked
Active
Viewed 2,274 times
1 Answers
10
You can append (.) to a pattern to restrict matches to plain files as long as the Bare_Glob_Qual option is set, which it is by default unless you have zsh emulating some other shell. This is covered in the Glob Qualifiers section of the zshexpn manpage.
So the full pattern to match regular files in the current directory and any of its subdirectories would be **/*(.).
qqx
- 2,893
- 19
- 16
-
3While your answer perfectly answers the question body -- I want to comment on @Erik's question title: To exclude directories use `**/*(^/)` -- with that symbolic links, fifos etc are listed, whereas with `**/*(.)` they are not. – mpy Oct 15 '13 at 09:49