Gordon Ross wrote:
>>>> On 07 March 2007 at 10:49, in message
> <[EMAIL PROTECTED]>,
> Sylvester Lykkehus <[EMAIL PROTECTED]> wrote:
>> Vince Oliver wrote:
>>> Hi All,
>>>
>>>
>>> How to easily remove some particular files from more than one 
>>> directory.  For example I have directories:
>>>
>>> $ ls -l
>>> total 12
>>> drwx------+ 2 ovince None     0 Mar  6 16:36 DHbox1
>>> drwx------+ 2 ovince None     0 Mar  7 08:30 DHbox10
>>> drwx------+ 2 ovince None     0 Mar  6 16:36 DHbox2
>>> drwx------+ 2 ovince None     0 Mar  6 16:36 DHbox3
>>> drwx------+ 2 ovince None     0 Mar  6 16:36 DHbox4
>>> drwx------+ 2 ovince None     0 Mar  7 08:31 DHbox5
>>> drwx------+ 2 ovince None     0 Mar  6 16:37 DHbox6
>>> drwx------+ 2 ovince None     0 Mar  6 16:37 DHbox7
>>> drwx------+ 2 ovince None     0 Mar  6 16:37 DHbox8
>>> drwx------+ 2 ovince None     0 Mar  6 16:37 DHbox9
>>>
>>> from all these directories I would like to remove JUST files that 
>>> finish wit suffix = 'pro' and suffix = '.dat' keeping others
> untouched
>>> thanks
>>> oliver
>> Hi Oliver,
>> find DHbox* -name *.dat | xargs rm
>> should do the trick.
> 
> Don't you need quotes around the *.dat to stop the shell expanding it
> ?
That or a '\' in front.

$ find DHbox* -name "*.dat" -o -name "*.pro" -exec rm -f {} \;

would do. Omit the final "-exec..." to first check that it only catches
those files you want to get rid of.

HTH

Cheers. Bye.

Ph. A.

-- 

*Philippe Andersson*
Unix System Administrator
IBA Particle Therapy |
Tel: +32-10-475.983
Fax: +32-10-487.707
eMail: [EMAIL PROTECTED]
<http://www.iba-worldwide.com>





The contents of this e-mail message and any attachments are intended solely for 
 
the recipient (s) named above. This communication is intended to be and to  
remain confidential and may be protected by intellectual property rights. Any  
use of the information contained herein (including but not limited to, total or 
 
partial reproduction, communication or distribution of any form) by persons  
other than the designated recipient(s) is prohibited. Please notify the sender  
immediately by e-mail if you have received this e-mail by mistake and delete  
this e-mail from your system. E-mail transmission cannot be guaranteed to be  
secure or error-free. Ion Beam Applications does not accept liability for any  
such errors. Thank you for your cooperation.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to