Copy files while preserving permissions

The unix cp command makes you the owner of the copied files. You can set flags but this is supposedly a more complete way to keep any attributes.

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

found @
http://info.michael-simons.eu/2007/03/18/copy-directories-and-preserve-permissions/

Add Your Comments

Required
Required
Tips

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <ol> <ul> <li> <strong>

Your email is never published nor shared.

Ready?