Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 04 Feb 2009 22:38:00 -0500
From:      William Gordon Rutherdale <will.rutherdale@utoronto.ca>
To:        freebsd-questions@freebsd.org
Subject:   Re: shell commands - exclusion
Message-ID:  <498A5F18.1060500@utoronto.ca>
In-Reply-To: <20090204091459.G16842@qroenaqrq.6qbyyneqvnyhc.pbz>
References:  <332f78510902040635k6675a9b6u434879b42c66a579@mail.gmail.com> <20090204091459.G16842@qroenaqrq.6qbyyneqvnyhc.pbz>

next in thread | previous in thread | raw e-mail | index | archive | help
Lars Eighner wrote:
> On Wed, 4 Feb 2009, t-u-t wrote:
>
>> hi, i don't know if this is a freak question, but i was looking 
>> around to
>> see if this is possible, and what the convention would be.
>>
>> 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}
>
> In general this is not possible. . . .
Oh yes it is, it is very easy.  I've done things like this in unix 
environments for years.  I also apply it to tar commands all the time.

All you have to do is this:

$ ls >rm.in
$ vi rm.in
   . . . edit out all the files you don't want to erase . . .
$ rm `cat rm.in`

-Will





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?498A5F18.1060500>