Commands to copy a file heirarchy between two directories:
# cd /original/dir # tar -cf - . | (cd /new/dir && tar -xf -)
- '-p' option may be required to preserve permissions (say, on Tru64).
- '-C' option can often be used to remove the 'cd' for changing destination directory.
- '-l', '--one-file-system' non-standard options can be used to restrict tar to reading from the one filesystem. If not available, null or loopback mounts could be used.
- '-v' can be added to the second tar to list files as they are copied.
- Handling of sparse files, extended attributes (ACLs, BSD extended file flags, ...) and special files (fifos, character and block special files, named sockets, doors, ...) are all largely implementation defined.
# pax -rwpe /original/dir /new/dir
- '-v' option can be used to list files as they are copied.
- '-X' option can be used to restrict tar to reading from the one filesystem.
# cd /original/dir # find . -print | cpio -pdl /new/dir