ZSH how to glob non-symlink files inside symlink directories

Viewed 183

How to glob **/*.log, where ** could be symlinks to directories but the .log files are not symlinks? I did try **(@)/*.log and **/*.log(@) without any luck.

1 Answers

To follow symbolic links, you need yet another asterisk:

***/*.log

Look for the Recursive Globbing section in the zshexpn man page.

Depending on how your links are set up, you could get the same file listed multiple times in the glob results (that's probably why zsh doesn't include symbolic links in the ** pattern).

Related