From owner-freebsd-questions@FreeBSD.ORG Thu Feb 5 03:05:32 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0766E1065670 for ; Thu, 5 Feb 2009 03:05:32 +0000 (UTC) (envelope-from jaime@snowmoon.com) Received: from rn-out-0910.google.com (rn-out-0910.google.com [64.233.170.191]) by mx1.freebsd.org (Postfix) with ESMTP id C739A8FC1C for ; Thu, 5 Feb 2009 03:05:31 +0000 (UTC) (envelope-from jaime@snowmoon.com) Received: by rn-out-0910.google.com with SMTP id k32so13971rnd.12 for ; Wed, 04 Feb 2009 19:05:31 -0800 (PST) MIME-Version: 1.0 Received: by 10.150.206.1 with SMTP id d1mr82586ybg.139.1233803130001; Wed, 04 Feb 2009 19:05:30 -0800 (PST) In-Reply-To: <332f78510902040635k6675a9b6u434879b42c66a579@mail.gmail.com> References: <332f78510902040635k6675a9b6u434879b42c66a579@mail.gmail.com> Date: Wed, 4 Feb 2009 22:05:29 -0500 Message-ID: From: Jaime To: t-u-t Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: shell commands - exclusion X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Feb 2009 03:05:32 -0000 On Wed, Feb 4, 2009 at 9:35 AM, t-u-t wrote: > if i have say one (or even two) single file/directories among many others, > and i want to perform any said function like cp, mv, rm, etc.. , to all > other files except that one or two, is there a way to do that in a single > command? > e.g > rm -r * {-except foo1 foo15} I'm just shooting in the dark here, but what about this? ls | grep -v foo1 | grep -v foo15 | xargs rm -rf Remember the Unix "pipe" and the grep and xargs commands. It can solve a lot of things by stringing together a lot of smaller commands. I think that this might be one of those situations. Good luck, Jaime -- "To affect the quality of the day, that is the highest of arts." -- Henry David Thoreau Tone of voice in email is misunderstood 50% of the time. Source: http://www.howtoweb.com/cgi-bin/insider.pl?zone=214061