From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96078612210213.tru64-unix-managers.marc@archive.invalid> From: Guy Dallaire Date: Wed, 07 May 1997 14:36:57 +0000 To: tru64-unix-managers Subject: SUMM: Easiest way to move a directory tree X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96078612210213 Thanks for your many replies: Dan Bowman , Lucio Chiappetti , Olle Eriksson , And everyone else that I could forget Most of you told me that I was almost right with my command, but that I neglected to put the 'p' option for the extraction. Also, in order to preserve setuid and setgid permissions, you have to be root when you copy the directory. Someone also suggested that I use the 'cp -pR' command to copy the tree, this should preseve the sym links. Here is the original question: --------------------------- I have to move a HUGE directory tree (oracle software installation) to a different file system. I made some preliminary tests and I am not satisfied with the results. I don't want to ressort to a backup/restore of the directory. Here is my problem: The various subdirectories contains symbolic links, I had problems moving it with mv, got error messages. I also tried with the following command: cd fromdir; tar -cf . | (cd todir; tar xf -) In this case, the file timestamps changed (when I do an ls -l). Is there a way to move that directory tree somewhere else and: a) Preserve the same file protections b) Preserve the files timestamps c) Preserve file ownership --------------------------- And (some) answers: --------------------------- You did it almost. What is missing is the "p" (preserve) flag. The way I use to move a tree is tar cmpf - -C origin . | (cd destination ; tar xvmpf -) the use of -C is the same as your first cd ; the p flag makes the difference (probably it is needed only on one side, but this way works anyhow) --------------------------- Have you tried using "cp -pR " The -p option retains files information The -R makes the new links that correspond with the new tree. Then just delete the old tree. Check out the man page for cp. ---------------------------------------------- This is what I use to move directory structures around: (cd fromdir; tar cf - . ) | (cd todir; tar xpf -) ----------------------------------------------------------- Guy Dallaire dallaire@total.net "God only knows if god exists"