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?


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 **/*(.).

  • 3
    While 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 9:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.