Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jan 2010 20:40:13 -0600
From:      David Kelly <dkelly@hiwaay.net>
To:        CyberLeo Kitsana <cyberleo@cyberleo.net>
Cc:        "Aryeh M. Friedman" <aryeh.friedman@gmail.com>, freebsd-questions@freebsd.org
Subject:   Re: OT: finding every file not in a list
Message-ID:  <08A06102-454D-4E82-8447-F2170978972D@hiwaay.net>
In-Reply-To: <4B620E5E.2040908@cyberleo.net>
References:  <4B6090FC.4070002@gmail.com> <4B620E5E.2040908@cyberleo.net>

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

On Jan 28, 2010, at 4:23 PM, CyberLeo Kitsana wrote:

> 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/

[...]

I think mtree(8) is the proper tool for this job. Especially the -r option:

     -r    Remove any files in the file hierarchy that are not described in
           the specification.

--
David Kelly N4HHE, dkelly@HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?08A06102-454D-4E82-8447-F2170978972D>