Rsync
From Liki
[edit] Rsync
[edit] Restoring Permissions with rsync
It may happen that you copied a bunch of files or a directory tree, but forgot to preserve permissions or ownerships when the copy took place. It may be difficult or impossible to change them all by hand or to copy the files the second time. One could write a custom script to compare the two trees and update permissions, etc... this can be done automatically with rsync. The following command
rsync -va /src/dir/ /dest/dir/
will compare the source directory /src/dir to the destination /dest/dir and then update the destination to match ownerships, timestamps, and permissions of the source. The option -a is for archive which includes all of the permission and ownership preservation options. The option -v is for verbose so you can see what it is doing. The first time you run it you may want to add -n for 'dry run', which shows what rsync will do without actually changing any files.
The method works since rsync will notice that the files are identical so that no actual data will be copied. Only the permission information will by updated. If the files are on another computer one can do
rsync -va -e ssh user@machine:/src/dir/ /dest/dir/
which runs rsync over shh.

