Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Feb 2009 19:03:37 +0100
From:      Roland Smith <rsmith@xs4all.nl>
To:        t-u-t <marshc187@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: shell commands - exclusion
Message-ID:  <20090204180337.GC64529@slackbox.xs4all.nl>
In-Reply-To: <332f78510902040635k6675a9b6u434879b42c66a579@mail.gmail.com>
References:  <332f78510902040635k6675a9b6u434879b42c66a579@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--bajzpZikUji1w+G9
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.
>=20
> 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.

Roland
--=20
R.F.Smith                                   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)

--bajzpZikUji1w+G9
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (FreeBSD)

iEYEARECAAYFAkmJ2HkACgkQEnfvsMMhpyWv0ACgqFzXhgOIELKO8NZDb9TesZ9K
kTYAn2T0O8kD7Ssaxq2H0vW69k3Z56iY
=pE6e
-----END PGP SIGNATURE-----

--bajzpZikUji1w+G9--



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