LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   how to change relitive links to specific links? (https://www.linuxquestions.org/questions/linux-general-1/how-to-change-relitive-links-to-specific-links-200265/)

wolfe2554 07-02-2004 06:06 AM

how to change relitive links to specific links?
 
hi,
my question is if I have a directory that is full of relitive links such as ../../bin/usr/java and I want to make it link /bin/usr/java so that when I move the link it does not get lost, what program could I use. The basis of this problem is that I want to move all of /usr and when one does this the /usr/bin and /usr/lib and /usr/share all get very mad. so mad that not even clear command will work any longer. Does anyone have an idea.

linuxxed 07-02-2004 06:35 AM

Re: how to change relitive links to specific links?
 
Quote:

Originally posted by wolfe2554
hi,
my question is if I have a directory that is full of relitive links such as ../../bin/usr/java and I want to make it link /bin/usr/java so that when I move the link it does not get lost, what program could I use. The basis of this problem is that I want to move all of /usr and when one does this the /usr/bin and /usr/lib and /usr/share all get very mad. so mad that not even clear command will work any longer. Does anyone have an idea.


really don't understand your question. If you want to remove a link, use rm. if you want to make a link use ln -s

wolfe2554 07-03-2004 12:05 AM

not really, I want to move /usr to another partition. in order to do this I need to make all the links that are relitive to file system place not relitive. So say I have a file in /usr/lib called X11 this file is a sym link to /usr/X11R6/lib/X11. now when you look at the X11 file in /usr/lib it is a link to ../X11R6/lib/X11. If you move just the /usr/lib to another place say /secondhd/usr/lib then the link will no longer work. it will try and fail to find ../X11R6/lib/X11. so the solution is to make the link in /usr/lib/X11 link to /usr/X11R6/lib/X11. Now this is fine for one or two files but I need to do it for over two gigs of files that are quite small. so what I need is a program that will go though all of /usr and locate any files that are links like ../../etc . . . and replace the link with /etc/ . . . what ever that may be. I was thinking of writing a script to do it but it would be far preferable to find an existing program. Does anyone have an idea?


thank you,
wolfe

comp12345 07-03-2004 12:36 AM

Make a symbolic link from /secondhd/usr/lib to /usr/lib
Code:

ln -s /secondhd/usr/lib /usr/lib
Then you won't have to change anything. Although a better solution would be to move the contents of /usr/lib onto the new partition then mount the partition to /usr/lib.

wolfe2554 07-03-2004 12:40 AM

thank you comp I know that the ln command would not work but the idea of mounting the directory at /usr/lib is a great one.

thank you so much
wolfe


All times are GMT -5. The time now is 04:45 AM.