ntp server: mulitiple interfaces

Bill Campbell bill
Mon May 17 11:45:23 PDT 2004


On Sun, Mar 09, 2003 at 07:39:59PM -0500, Bruce Marshall wrote:
...
>> That's fine for some things, but consider two directories that
>> are very similar, and you want to find which files are in dir2
>> that aren't in dir1.
>>
>> 	cd dir1
>> 	find . -type f | sort > /tmp/list1
>> 	cd dir2
>> 	find . -type f | sort > /tmp/list2
>> 	comm -13 /tmp/list1 /tmp/list2 > /tmp/list3
>>
>> Now /tmp/list3 has a list of all files in dir2 that aren't in dir1.
>> Perhaps you want to copy all the files from dir2 that aren't in
>> dir1, now you can run:
>>
>> 	cpio -pdumv dir1 < /tmp/list3
>>
>> Bill
>
>Would rsync be an easier way to do this?  Use the 'n' option first to see 
>what files would be copied...  then without the 'n' option to do the 
>copying....

That depends on what you're doing.  I certainly use rsync extensively, but
my main point was to demonstrate one place where ``comm'' can be very
useful.  Unlike ``diff'', comm simply produces lists of files which can
then be used for a variety of things.

``There's more than one way to do it'' doesn't only apply to perl.

Bill
--
INTERNET:   bill at Celestial.COM  Bill Campbell; Celestial Software LLC
UUCP:               camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

"A man full of faith is simply one who has lost (or never had) the capacity
for clear and realistic thought. He is not a mere ass; he is actually ill.
Worse, he is incurable."
	H.L. Mencken


More information about the Linux-users mailing list