shell commands - exclusion
Jaime
jaime at snowmoon.com
Wed Feb 4 19:05:32 PST 2009
On Wed, Feb 4, 2009 at 9:35 AM, t-u-t <marshc187 at 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
More information about the freebsd-questions
mailing list