OT: finding every file not in a list

David Kelly dkelly at hiwaay.net
Fri Jan 29 02:40:05 UTC 2010


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 at HiWAAY.net
========================================================================
Whom computers would destroy, they must first drive mad.





More information about the freebsd-questions mailing list