Copying directories with tar

In AIX, you can use the following command to copy all files from one directory to another, recursively, keeping all permissions, links, sockets, etc.

cd sourcedir
tar cdf - * .??* | ( cd targetdir; tar xfp - )

Note : this assumes no files that are . followed by a single character.

About

I'm a freelance UNIX engineer working in the UK. I'm married to Tina and between us we have six children. I'm a bit of an Apple fan boy, and all the Windows machines in the house are a thing of the past now.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: