From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12235 invoked by alias); 9 Jan 2009 04:20:03 -0000 Received: (qmail 12227 invoked by uid 22791); 9 Jan 2009 04:20:02 -0000 X-SWARE-Spam-Status: No, hits=2.1 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_64,RCVD_IN_CHINA,RCVD_IN_DNSWL_LOW,RCVD_NUMERIC_HELO,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 09 Jan 2009 04:19:59 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LL8qD-0005q4-OL for cygwin@cygwin.com; Fri, 09 Jan 2009 04:19:56 +0000 Received: from 159.226.135.215 ([159.226.135.215]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 09 Jan 2009 04:19:25 +0000 Received: from hongyi.zhao by 159.226.135.215 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 09 Jan 2009 04:19:25 +0000 To: cygwin@cygwin.com From: Hongyi Zhao Subject: Re: Delete a specific type of files when they exist. Date: Fri, 09 Jan 2009 07:34:00 -0000 Message-ID: <41kdm45vldi3hvphks32s944moh7u3i6l5@4ax.com> References: <4966CC16.10809@users.sourceforge.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2009-01/txt/msg00213.txt.bz2 On Thu, 08 Jan 2009 22:01:26 -0600, "Yaakov (Cygwin/X)" wrote: >-----BEGIN PGP SIGNED MESSAGE----- >Hash: SHA256 > >Hongyi Zhao wrote: >> I want to delete the all of the cache-2 files under a directory, so I >> use the following line to do this: >> >> if [ -f *.cache-2 ] rm *.cache-2 >> >> But it seems that this -f parameter in the _if_ command will not work >> with wildcard, i.e., the _[ -f *.cache-2 ]_ isn't a valid arg. Any >> hints on this issue? > >find /path/to/directory -name '*.cache-2' -delete Good, thanks, I've got it. -- .: Hongyi Zhao [ hongyi.zhao AT gmail.com ] Free as in Freedom :. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/