how-to

Recipe: How to copy files and directories recursively with tar

TAR is the Unix Tape ARchive utility. It can be used to either store data on a streaming tape device like a DAT drive, or store files in what is commonly called a tarball file - somewhat like a pkzip file, only compression is optional.

Copying a directory tree and its contents to another filesystem using tar will preserve ownership, permissions, and timestamps. A neat trick allows using tar to perform a recursive copy without creating an intermediate tar file.

To copy all of the files and subdirectories in the current working directory to the directory /target, use:

Syndicate content