From owner-freebsd-questions@FreeBSD.ORG Thu Feb 5 03:38:02 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 39FA41065670 for ; Thu, 5 Feb 2009 03:38:02 +0000 (UTC) (envelope-from will.rutherdale@utoronto.ca) Received: from mail.vex.net (smaug.vex.net [208.76.104.132]) by mx1.freebsd.org (Postfix) with ESMTP id 1454D8FC13 for ; Thu, 5 Feb 2009 03:38:01 +0000 (UTC) (envelope-from will.rutherdale@utoronto.ca) Received: from [192.168.110.8] (unknown [207.35.13.175]) by mail.vex.net (Postfix) with ESMTPA id 021A2174D9 for ; Wed, 4 Feb 2009 22:37:59 -0500 (EST) Message-ID: <498A5F18.1060500@utoronto.ca> Date: Wed, 04 Feb 2009 22:38:00 -0500 From: William Gordon Rutherdale User-Agent: Thunderbird 1.5.0.14ubu (X11/20080505) MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <332f78510902040635k6675a9b6u434879b42c66a579@mail.gmail.com> <20090204091459.G16842@qroenaqrq.6qbyyneqvnyhc.pbz> In-Reply-To: <20090204091459.G16842@qroenaqrq.6qbyyneqvnyhc.pbz> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: Thu, 05 Feb 2009 03:38:02 -0000 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