Sponsored Content
Top Forums UNIX for Dummies Questions & Answers tar symlinks: relative vs absolute Post 302346320 by TreeMan on Friday 21st of August 2009 01:41:15 PM
Old 08-21-2009
Thanks for the reply. I tried to do this with mixed results. If the link was farther down the path, it woked, ie:

ln -s test/test/filea.txt filea.txt

This is restored no problem. But if I have a link like so:

ln -s ../test/filea.txt filea.txt

Then even though the parent dir and it's child 'test' are in the tar, the link is replaced with an actual copy of the file, so that an ls -al will show a file there now instead of a link. This does make sense to my why it would work this way, but I need it to not work that way. Smilie

Maybe tar is the wrong answer. I really just need to be able to archive up a bunch of files under /usr and then extract them under /tmp/test and have any links in there that used to point to /usr/... now point to /tmp/test/... Is this possible? The alternative will be to make a list of the symlinks using something like 'find . -type l' and then create a script to insert the symlinks after extraction. This is a less desirable option.

Thanks again

Edit: the less desirable option won. I made a script to go in and redo the absolute links so they use the new absolute path.

Last edited by TreeMan; 08-21-2009 at 05:58 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Relative directory - NOT absolute

Here is the drill, I am using a script to login to a remote ftp, and put and get files. My question is: I want to login and automatically change to the same directory I am in on my machine. I can not use $home, pwd or anyother env variable (that I know) since the names of the machines are totally... (4 Replies)
Discussion started by: sierra_aar
4 Replies

2. UNIX for Dummies Questions & Answers

vi - replacing a relative path with absolute path in a file

Hi, I have a file with about 60 lines of path: app-defaults/boxXYZ....... I want to change this to /my/path/goes/here/app-defaults/boxXYZ, but of course vi doesn't like the regualr :s/old/new/ command. Is there any other quick way to do this? Thanks ;) (2 Replies)
Discussion started by: Yinzer955i
2 Replies

3. Solaris

Extracting file from tar at relative location!!

Hi Gurus, I have a .tar file which required untar to the new location. I list the content with –tvf its listing the files which are inside the tar, when I am extracting he file from tar its working fine, however once I am trying to extract the file at the new location I am unable to do so. I... (11 Replies)
Discussion started by: kumarmani
11 Replies

4. UNIX for Dummies Questions & Answers

Absolute and Relative Paths?

Can someone cofirm that I have got the paths correct here? :confused: $PATH_TO_TMP_DIR='/tmp'; #$PATH_TO_TMP_DIR='home/tmp'; $PATH_TO_YOUR_IMG_DIR = '/temp_images'; #$PATH_TO_YOUR_IMG_DIR = 'home/public_html/Midwich/temp_images'; Thanks (1 Reply)
Discussion started by: stubie
1 Replies

5. Shell Programming and Scripting

absolute path for a script ran with relative path

I have a script in which i want to print absolute path of the same script irrespective of path from where i run script. I am using test.sh: echo "pwd : `pwd`" echo "script name: $0" echo "dirname: `dirname $0`" when i run script from /my/test/dir/struct as ../test.sh the output i... (10 Replies)
Discussion started by: rss67
10 Replies

6. UNIX for Advanced & Expert Users

accessing NFS absolute path symlinks from windows/cygwin

Hi experts, I was wondering if there is a way to access some NFS symlink files that are set using absolute paths from Windows? On windows/cygwin, I'm able to access relative path symlinks but not the absolute path symlinks. Assume on Linux (mylinux): /usr/local/file.c ln -s... (1 Reply)
Discussion started by: andredz
1 Replies

7. Shell Programming and Scripting

tar and relative paths

HOw can I create a tar file with relative paths find . -depth -print | xargs tar -cvf /tmp/file.tar ? Thanks to all who answer (1 Reply)
Discussion started by: BeefStu
1 Replies

8. UNIX for Dummies Questions & Answers

How to convert relative path to absolute path?

Hello Everyone, I want to convert Relative Path - /home/stevin/data/APP_SERVICE/../datafile.txt to Absolute Path - /home/stevin/data/datafile.txt Is there a built-in tool in Unix to do this or any good ideas as to how can I implement this. -Steve (5 Replies)
Discussion started by: qwarentine
5 Replies

9. Shell Programming and Scripting

Show only the filenames under a directory without relative and absolute paths.

I am able to list all the filenames under a directory & its sub-directories except blent.tar on Linux find "/tmp/" -type f | grep -v blent.tar | rev | cut -d '/' -f1 | rev Desired Output: THIRDPARTYLICENSEREADME.txt javaws libjavaplugin_oji.so libjavaplugin_oji.so... (3 Replies)
Discussion started by: mohtashims
3 Replies

10. UNIX for Beginners Questions & Answers

Convert Relative path to Absolute path, without changing directory to the file location.

Hello, I am creating a file with all the source folders included in my git branch, when i grep for the used source, i found source included as relative path instead of absolute path, how can convert relative path to absolute path without changing directory to that folder and using readlink -f ? ... (4 Replies)
Discussion started by: Sekhar419
4 Replies
SYMLINKS(8)						      System Manager's Manual						       SYMLINKS(8)

NAME
symlinks - symbolic link maintenance utility SYNOPSIS
symlinks [ -cdorstv ] dirlist DESCRIPTION
symlinks is a useful utility for maintainers of FTP sites, CDROMs, and Linux software distributions. It scans directories for symbolic links and lists them on stdout, often revealing flaws in the filesystem tree. Each link is output with a classification of relative, absolute, dangling, messy, lengthy, or other_fs. relative links are those expressed as paths relative to the directory in which the links reside, usually independent of the mount point of the filesystem. absolute links are those given as an absolute path from the root directory as indicated by a leading slash (/). dangling links are those for which the target of the link does not currently exist. This commonly occurs for absolute links when a filesystem is mounted at other than its customary mount point (such as when the normal root filesystem is mounted at /mnt after booting from alternative media). messy links are links which contain unnecessary slashes or dots in the path. These are cleaned up as well when -c is specified. lengthy links are links which use "../" more than necessary in the path (eg. /bin/vi -> ../bin/vim) These are only detected when -s is specified, and are only cleaned up when -c is also specified. other_fs are those links whose target currently resides on a different filesystem from where symlinks was run (most useful with -r ). OPTIONS
-c convert absolute links (within the same filesystem) to relative links. This permits links to maintain their validity regardless of the mount point used for the filesystem -- a desirable setup in most cases. This option also causes any messy links to be cleaned up, and, if -s was also specified, then lengthy links are also shortened. Links affected by -c are prefixed with changed in the output. -d causes dangling links to be removed. -o fix links on other filesystems encountered while recursing. Normally, other filesystems encountered are not modified by symlinks. -r recursively operate on subdirectories within the same filesystem. -s causes lengthy links to be detected. -t is used to test for what symlinks would do if -c were specified, but without really changing anything. -v show all symbolic links. By default, relative links are not shown unless -v is specified. BUGS
symlinks does not recurse or change links across filesystems. AUTHOR
symlinks has been written by Mark Lord <mlord@pobox.com>, the original developer and maintainer of the IDE Performance Package for linux, the Linux IDE Driver subsystem, hdparm, and a current day libata hacker. SEE ALSO
symlink(2) Version 1.4 October 2008 SYMLINKS(8)
All times are GMT -4. The time now is 02:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy