Skip to content
accelerando

Copy directories and preserve permissions

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.

Post a Comment

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

*
Close
E-mail It