From owner-freebsd-questions@FreeBSD.ORG Thu Jan 28 22:23:29 2010 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 0D330106568F for ; Thu, 28 Jan 2010 22:23:29 +0000 (UTC) (envelope-from cyberleo@cyberleo.net) Received: from paka.cyberleo.net (paka.cyberleo.net [66.219.31.21]) by mx1.freebsd.org (Postfix) with ESMTP id DD78D8FC12 for ; Thu, 28 Jan 2010 22:23:28 +0000 (UTC) Received: from [172.16.44.14] (h-74-2-96-2.chcgilgm.static.covad.net [74.2.96.2]) by paka.cyberleo.net (Postfix) with ESMTPSA id 06A9B295D6; Thu, 28 Jan 2010 17:23:27 -0500 (EST) Message-ID: <4B620E5E.2040908@cyberleo.net> Date: Thu, 28 Jan 2010 16:23:26 -0600 From: CyberLeo Kitsana User-Agent: Thunderbird 2.0.0.23 (X11/20091109) MIME-Version: 1.0 To: "Aryeh M. Friedman" References: <4B6090FC.4070002@gmail.com> In-Reply-To: <4B6090FC.4070002@gmail.com> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org Subject: Re: OT: finding every file not in a list 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, 28 Jan 2010 22:23:29 -0000 Aryeh M. Friedman wrote: > I have a list of files that should be in a dir tree and want to remove > any files from the tree not in list (i.e. if it is on the list keep it > else rm it)... any quick way to do this? # ls -1F keep old/ # find old old old/a old/a/1 old/a/4 old/b old/b/2 old/b/5 old/c old/c/3 old/c/6 # find new find: new: No such file or directory # cat keep a/4 b/5 c/6 # ( cd old; cat ../keep | cpio -pld ../new ) /tmp/old 0 blocks # ls -1F keep new/ old/ # find new new new/a new/a/4 new/b new/b/5 new/c new/c/6 -- Fuzzy love, -CyberLeo Technical Administrator CyberLeo.Net Webhosting http://www.CyberLeo.Net Furry Peace! - http://wwww.fur.com/peace/