> either. To copy directory trees, I usually use "( cd /fromdir ; tar > cf - . ) | ( cd /todir ; tar xpf -)", which preserves modification > times, and permissions.
I definitely am a fan of tar copying, but wouldn't recommend the above (as written). The brief explanation is that you really want to replace the ';' inside of the parens with '&&'. Below is the more complete example of why it matters: ## set up the test scenario [EMAIL PROTECTED] tmp]# cd /tmp [EMAIL PROTECTED] tmp]# mkdir foo1 foo2 [EMAIL PROTECTED] tmp]# cp /etc/hosts foo1 ## make sure there is no /tmp/hosts [EMAIL PROTECTED] tmp]# ls -al hosts ls: hosts: No such file or directory ## execute the command, but with a typo in the second 'cd' command [EMAIL PROTECTED] tmp]# (cd /tmp/foo1; tar -cf - *) | (cd /tmp/f002; tar -xf -) bash: cd: /tmp/f002: No such file or directory ## check to see if /tmp/hosts exists now? Oops. [EMAIL PROTECTED] tmp]# ls -al hosts -rw-r--r-- 1 root root 153 Nov 14 13:10 hosts [EMAIL PROTECTED] tmp]# ls -al foo2 total 2 drwxr-xr-x 2 root root 1024 Nov 14 13:10 . drwxrwxrwt 8 root root 1024 Nov 14 13:10 .. For folks new to unix-- replacing the semi-colon after the 'cd' command with '&&' causes the command following to not get executed. Logically speaking, it's a way of saying: Execute this command AND THEN this other command. If the first command fails, don't execute the second command. -ron
