Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Feb 2009 19:03:37 +0100
From:      Roland Smith <>
To:        t-u-t <>
Subject:   Re: shell commands - exclusion
Message-ID:  <>
In-Reply-To: <>
References:  <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help

Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Feb 04, 2009 at 03:35:52PM +0100, 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}

The easiest way would be to move the few files/directories you don't
want to include in your command out of the way first. :-)

> and if there is, could the same be applied to other similar batch (?)
> operations, like pkg_delete -f "*" { except firefox3 wine thunderbird }
> etc..
I don't think so.

If the couple of files you don't want to rm/whatever you could try using
the find(1) command to get all the other files. The find command is a
very good tool to know.

> i'm a bit new to the shell (took me a while to figure out *ls* and *ls |
> more*), but i can't find anything from google cuz i don't know what this
> would be called in the first place.

Maybe a stupid question, but do you know how to read manual pages?
E.g. for 'find', just enter the command 'man find' in your shell.

> otherwise is it better to protect them with chflags or other trickery?

That would be my other suggestion.

[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)

Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v2.0.10 (FreeBSD)



Want to link to this message? Use this URL: <>