OT: finding every file not in a list

CyberLeo Kitsana cyberleo at cyberleo.net
Thu Jan 28 22:23:29 UTC 2010


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

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


More information about the freebsd-questions mailing list