delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/01/08/23:01:42

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4966CC16.10809@users.sourceforge.net>
Date: Thu, 08 Jan 2009 22:01:26 -0600
From: "Yaakov (Cygwin/X)" <yselkowitz AT users DOT sourceforge DOT net>
User-Agent: Thunderbird 2.0.0.19 (Windows/20081209)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Delete a specific type of files when they exist.
References: <rfidm4hfs5p9h6s40obf5s083onsau7j26 AT 4ax DOT com>
In-Reply-To: <rfidm4hfs5p9h6s40obf5s083onsau7j26@4ax.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

-----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


Yaakov
Cygwin/X
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEAREIAAYFAklmzBYACgkQpiWmPGlmQSOmSQCfZvId1CpcIoMd944rX6BKtGv7
8o0AoOdW/rs3MjBagIV/qVbBx2odSUZT
=pJb/
-----END PGP SIGNATURE-----

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019