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

Re: Some problems with recursive globbing



On Thu, 7 May 2015 16:35:57 +0200
Jesper Nygårds <jesper.nygards@xxxxxxxxx> wrote:
> Question: I found it surprisingly difficult to to find a glob pattern that
> excluded target directories and their contents at all levels. Have I
> complicated this too much, is there an easier way to express this glob?

Yes, you can use '(^target/)#'.

Note also that after "~" is just a pure pattern --- / isn't special.
So if you had to exclude explicitly as /target/ or target/ or /target
you'd use ~(|*/)target(|*/)

> Problem: I can't get this to work for both cases of a) directories with
> spaces in their names and b) directories with parenthesis in their names

Native zsh options are *supposed* to be set up to be insensitive to this
sort of nonsense...

Try putting

emulate -L zsh

as the first line of your function.  I may have missed something more
subtle.

pws



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