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

Re: Excluding files in CVS directories in filename generation



Hannu Koivisto wrote:
> Greetings,
> 
> If I want a pattern that matches all files in the current directory
> and its descendant directories excluding files in directories named
> CVS, why doesn't
> 
> **/*~**/CVS/*(.)
> 
> work?  Files in "$(pwd)/CVS" are not excluded with that pattern and
> instead I have to say
> 
> **/*~CVS/*~**/CVS/*(.)

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.

You need extended_glob, but you must already have it set in this case.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



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