Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Symbolic Link Usage Question

Status
Not open for further replies.

FLAdmin

MIS
Mar 6, 2006
33
US
I want to know a little more about these symbolic links.

I have 1 folder with some files in it for global usage
I have many others numberically numbered for company specific data..

eg..

/usr2/globalcd (contains common company files)
/usr2/xxxx (numbered, specific to each company)

I have the usr2 folder shared so that windows sees it.

My goal since I need to make an odbc connection per company is to:

get the globalcd files to appear in each company folder as if they were there. as links or whatever. I just need to be able to read them and they need to be in those folders for my queries to work. I also need this to be visible to windows machines through the network.

thanks

 
have the usr2 folder shared so that windows sees it.
" -- is this with samba or visionfs or afps?

what OS are you using....

in each numbered directory do the following

ln -s /usr2/globalcd/filename filename

and replace the "filename" with the actual name of the file you wish to have linked.
 
i believe it's samba.

also one other question. deleting the file from a linked folder

eg. /company1

where it's only a link in there... deleting it will only delete the link and not the original file correct?
 
Probably a dumb question... but how to you know if what you are looking at is a link or the original file?

especially from the windows side over samba...?
 
from the windows side over samba you can't say if the file you see is a symbolic link or the real file, and yes only the symlink is removed if you delete the file.

But, if the symlink is a directory then deleting files inside it deletes the real files.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
In an earlier thread, I had you clear a user's mailbox file using the "> filename" method. On a symlink, this would, in fact, clear the real file. I just wanted to throw that out so there is no misunderstanding of what this would do.

Here's an example of displaying a symbolic link:
Code:
 # pwd
/usr/bin
# ls nohup
nohup
# l nohup
-rwx--x--x    1 bin      bin       5760 Jun  9  2005 nohup@
# ls -l nohup
lrwxrwxrwx    1 root     sys         37 Aug 24  2005 nohup -> /opt/K/SCO/Unix/6.0.0Ni/usr/bin/nohup
In the second line, the ending "@" indicates that it is a link. In the third line, the link is displayed.


 
also look an the man ls and find.

There are options there to give more detail etc.
You can also set your find to resolve links or treat them as links.

ie say in a cpio each link will go out and get the whole file copied. You have 3 links and 3 files will get copied without the link.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top