Delete a specific type of files when they exist.

Hongyi Zhao hongyi.zhao@gmail.com
Fri Jan 9 07:34:00 GMT 2009


On Thu, 08 Jan 2009 22:01:26 -0600, "Yaakov (Cygwin/X)"
<yselkowitz@users.sourceforge.net> 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/



More information about the Cygwin mailing list