vmiheer
vmiheer

Reputation: 148

ZSH how to glob non-symlink files inside symlink directories

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.

Upvotes: 3

Views: 464

Answers (1)

Gairfowl
Gairfowl

Reputation: 2981

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).

Upvotes: 3

Related Questions