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

Re: Excluding files in CVS directories in filename generation



On Mon, Dec 08, 2003 at 07:36:30PM +0200, Hannu Koivisto wrote:
> Peter Stephenson <pws@xxxxxxx> writes:
> 
> > Yes, indeed.  Luckily, you can do:
> >
> > (^CVS/)#*(.)
> >
> > This is the more general form of ** --- the pattern in the parentheses
> > is used (here anything but the string CVS) instead of a `*' to match
> > directory names.  More precisely,
> >   **/
> >   (*/)#
> > are equivalent.  That's why you don't need another / after the
> > parentheses.
> 
> Excellent, thanks!  I was aware of the general form but couldn't
> think of actually using it to solve this problem :)
> 
> I would be interested to know why **/*~**/CVS/*(.) didn't work,
> though.

The exclusion pattern after ~ does not treat "/" or "**/" specially.  As
far as I understand, the pattern is then used in the same way as for
string matching.  So if **/* generates CVS/Entries, it is not excluded,
because [[ CVS/Entries != **/CVS/* ]] .  To exclude the CVS directory
and all files below, you can use **/*~(*/)#CVS(/*)# Another way is
**/*~*CVS* , however this would also exclude filenames that contain
"CVS" string (e.g., aCVSb or CVS1/file).

HTH,

Pavol



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