This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Delete a specific type of files when they exist.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]