Copy directories and preserve permissions

March 18, 2007 by Michael

The following command will create a recursive copy of the current working directory preserving all file permissions and owners:

mkdir /var/backup/michael
cd /home/michael
tar cf - . | (cd /var/backup/michael && tar xBfp -)

Comes in handy while moving whole directory trees from one disk to a new one.

No comments yet

Post a Comment

Your email is never published nor shared. Required fields are marked *