[CentOS] compare directories

Bill Campbell centos at celestial.com
Thu Oct 23 18:13:48 UTC 2008


On Thu, Oct 23, 2008, MHR wrote:
>On Thu, Oct 23, 2008 at 10:15 AM, Bill Campbell <centos at celestial.com> wrote:
>>
>> A somewhat cleaner way of doing this is to use the ``comm''
>> command as it generates a straight list as opposed to diff which
>> requires parsing the output.
>>
>
>But comm also "requires" that the data be sorted.  Otherwise you can
>get spurious output because lines that are actually the same but do
>not appear in order will show up as differences.

That's certainly true, which is why my solution, and the one with
diff both sorted the find output before the comparison.

I use the ``comm'' solution quite frequently for this, and to do
things like compare ``rpm -ql packagename'' with ``rpm -qpl'' to
be sure that modifications I have made to a package have not
added or lost something compared to the installed version.

I find ``comm'' to be a very useful program that people may not
know of, and I use it in Linux/Unix classes I teach to show
people how CLI programs may make things much easier than GUIs.

>I'd go with the rsync solutions already posted, but that's just me.

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

One of the common failings among honorable people is a failure to
appreciate how thoroughly dishonorable some other people can be, and how
dangerous it is to trust them.
    - Thomas Sowell



More information about the CentOS mailing list