Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jan 2010 16:23:26 -0600
From:      CyberLeo Kitsana <cyberleo@cyberleo.net>
To:        "Aryeh M. Friedman" <aryeh.friedman@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: OT: finding every file not in a list
Message-ID:  <4B620E5E.2040908@cyberleo.net>
In-Reply-To: <4B6090FC.4070002@gmail.com>
References:  <4B6090FC.4070002@gmail.com>

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

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
<CyberLeo@CyberLeo.Net>

Furry Peace! - http://wwww.fur.com/peace/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B620E5E.2040908>