Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Compound Glob Specifiers



I expect this is a case of "you're holding it wrong", but I figure it's worth asking what the right way to do this is...

I want to glob the equivalent of */*/somefile (not **/foo, specifically two directories deep).

However, I do NOT want the glob to match if any of the directory components are a symlink.

*(/) is the glob specifier for directories [1]

It would then follow that *(/)/*(/)/somefile would match dir/dir/somefile and not dir/link/somefile.

This is not the case -- even *(/)/ (i.e. appending a trailing slash to all directories) do not work out-of-the-box as one might expect.  

I've read through 14.8 Filename Generation [2] as best I can (my favorite hack being the NTREF=reffile bit) but haven't found anything that suggests how one might do this.

[1] https://zsh.sourceforge.io/Doc/Release/Expansion.html#index-BARE_005fGLOB_005fQUAL_002c-use-of
[2] https://zsh.sourceforge.io/Doc/Release/Expansion.html#Filename-Generation

Zach Riggle



Messages sorted by: Reverse Date, Date, Thread, Author