Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 962
vmiheer Avatar asked Dec 02 '25 11:12

vmiheer


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

like image 180
Gairfowl Avatar answered Dec 04 '25 22:12

Gairfowl