Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We copy our production code and data files to a testing server on a weekly basis. It can take hours, and sometimes it hasn't finished.

What is the best method to confirm that the directories have been copied correctly from one server to another?

  • I was hoping that dircmp could be used, but I don't see how it can be used between servers.
  • My second option is to map (link) one of the directories to the other server, and then use dircmp on them.
share|improve this question

Write a list of the md5sums of the files in the directory in some specific order to a file, with, say, one md5sum per line, on both machines. Take the md5sum of that file. If the md5sums are the same, the directories are the same.

share|improve this answer

Can you do the comparison online? If so, use rsync or unison. Once they've finished running, the directories are identical. If you just want to test without changing anything, run rsync -vn and check that no file would be copied.

If you have no network connectivity, compute a checksum of all the files on both sides and compare that, as suggested by Faheem.

In fact, if you need to ask this question, there's probably something wrong with your setup. Whatever tool you're using to perform the copy should be telling you if everything was copied properly, by returning 0. If the copying tool returns nonzero or has not completed (yet), assume you don't have a complete copy.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.