tar the symbolic link | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

tar the symbolic link

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 05-23-2008
ganga.dharan ganga.dharan is offline
Registered User
 
Join Date: Jan 2008
Last Activity: 26 September 2012, 3:41 PM EDT
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
tar the symbolic link

Hi Experts!!

Can anyone help me out to know how can we tar the symbolic links. I would need to find the symbolic links present in the directory and then tar them out. I can find the links by find . -type l, but i need to know how to tar the symboilc link. Any help would be much appreciated..

Many thanks !!
Sponsored Links
    #2  
Old 05-23-2008
nua7 nua7 is offline
Registered User
 
Join Date: Mar 2008
Last Activity: 22 September 2014, 1:24 PM EDT
Location: /bin/sh
Posts: 423
Thanks: 24
Thanked 4 Times in 4 Posts
Normally, when tar archives a symbolic link, it writes a record to the archive naming the target of the link. In that way, the tar archive is a faithful record of the filesystem contents. `--dereference' (`-h') is used with `--create' (`-c'), and causes tar to archive the files symbolic links point to, instead of the links themselves. When this option is used, when tar encounters a symbolic link, it will archive the linked-to file, instead of simply recording the presence of a symbolic link.

The name under which the file is stored in the file system is not recorded in the archive. To record both the symbolic link name and the file name in the system, archive the file under both names. If all links were recorded automatically by tar, an extracted file might be linked to a file name that no longer exists in the file system.

If a linked-to file is encountered again by tar while creating the same archive, an entire second copy of it will be stored. (This might be considered a bug.)

So, for portable archives, do not archive symbolic links as such, and use `--dereference' (`-h'): many systems do not support symbolic links, and moreover, your distribution might be unusable if it contains unresolved symbolic links.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Symbolic Link Help LAVco Shell Programming and Scripting 2 06-07-2010 03:15 PM
symbolic link tonijel Shell Programming and Scripting 2 10-01-2009 06:23 AM
need some info about symbolic link and hard link detective linux UNIX for Dummies Questions & Answers 2 01-08-2008 06:36 AM
symbolic Link bhargav UNIX for Dummies Questions & Answers 1 10-15-2004 09:41 AM
1 symbolic link to 2 different places? Bashar UNIX for Advanced & Expert Users 2 08-27-2003 07:40 AM



All times are GMT -4. The time now is 07:43 PM.