tar: "preserve the symbolic links"
I have a need to migrate a web site tree and I wish to "preserve the symbolic links" with tar -- that is, to keep the symbolic link "as is" without copying the targeted files. The regular 'tar cf' copied target files for each symbolic link thus duplicated the files many times that I lost track which one should be the "original" file on the new site.
I used tar option 'h' as in 'tar chf' but that does the same as the default behavior. I failed to find which option does the opposite. Any advice please? joe |
Well for me this works..
Code:
~/tmp $ tar -cpvzf /tmp/tarball.tar.gz * |
The tar command should preserve symbolic links by default. I just tried a couple different attempts on my system using "tar cvjf tarball.tar.bz2 testdirectory/". I had links inside testdirectory that pointed to files within the directory and links that pointed outside the directory. All links were created--no dereferences.
Like I said, tar should preserve the symbolic links by default. So, you might want to check two things: 1. See if you have an alias for tar that includes the '-h' option automatically 2. Check your version of tar against any possible bug reports For reference, my tar: Code:
user@localhost$ tar --version |
Thank you both for your input. Our older RH Linux server was upgraded hence I could not verify. What you describe is repeatable on our new linux box though. Many thanks for taking time. Appreciated!
|
All times are GMT -5. The time now is 02:57 PM. |