cp -R
is generally unsafe to copy directories with since it will copy through symbolic links rather than just copying the link (newercp
's have an -H flag that will work around this). The classic unix way of doing things like this is a push-pulltar
:
% tar cf - dir-name | (cd /destination-dir; tar xf -)
In English: tar out through a pipe into a subshell that's changed directories, feeding that pipe into the tar extraction. If you run both sides of the pipeline as root (via
sudo
), the file owners and permissions will be preserved (whichcp
won't do)