From owner-freebsd-questions@FreeBSD.ORG Wed Feb 4 18:03:40 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9346C10656E4 for ; Wed, 4 Feb 2009 18:03:40 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from smtp-vbr7.xs4all.nl (smtp-vbr7.xs4all.nl [194.109.24.27]) by mx1.freebsd.org (Postfix) with ESMTP id 0FAD48FC12 for ; Wed, 4 Feb 2009 18:03:39 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from slackbox.xs4all.nl (slackbox.xs4all.nl [213.84.242.160]) by smtp-vbr7.xs4all.nl (8.13.8/8.13.8) with ESMTP id n14I3bOC059340; Wed, 4 Feb 2009 19:03:38 +0100 (CET) (envelope-from rsmith@xs4all.nl) Received: by slackbox.xs4all.nl (Postfix, from userid 1001) id B025ABAA3; Wed, 4 Feb 2009 19:03:37 +0100 (CET) Date: Wed, 4 Feb 2009 19:03:37 +0100 From: Roland Smith To: t-u-t Message-ID: <20090204180337.GC64529@slackbox.xs4all.nl> References: <332f78510902040635k6675a9b6u434879b42c66a579@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="bajzpZikUji1w+G9" Content-Disposition: inline In-Reply-To: <332f78510902040635k6675a9b6u434879b42c66a579@mail.gmail.com> X-GPG-Fingerprint: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 X-GPG-Key: http://www.xs4all.nl/~rsmith/pubkey.txt X-GPG-Notice: If this message is not signed, don't assume I sent it! User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: by XS4ALL Virus Scanner Cc: freebsd-questions@freebsd.org Subject: Re: shell commands - exclusion X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Feb 2009 18:03:41 -0000 --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--