Date: Wed, 4 Feb 2009 22:05:29 -0500 From: Jaime <jaime@snowmoon.com> To: t-u-t <marshc187@gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: shell commands - exclusion Message-ID: <ae4324ed0902041905p4497c155u5d474533bbd5151f@mail.gmail.com> In-Reply-To: <332f78510902040635k6675a9b6u434879b42c66a579@mail.gmail.com> References: <332f78510902040635k6675a9b6u434879b42c66a579@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Feb 4, 2009 at 9:35 AM, t-u-t <marshc187@gmail.com> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ae4324ed0902041905p4497c155u5d474533bbd5151f>