God
asked on
Can one determine whether a file has symbolic or hard links to it?
Is there any way with a shell command or in a perl script to determine if a file has a symbolic or hard link to it? The obvious solutions, using stat and checking the link count don't seem to work - files with links show count of 1, and directories show a count of 2.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
darn.
ASKER
How do you divy up points?
Used to be a "Split Points" link near the comment entrybox... Some have had luck with oldlook ... http://oldlook.experts-exchange.com/questions/20812105/Can-one-determine-whether-a-file-has-symbolic-or-hard-links-to-it.html#9850566
-- Glenn
-- Glenn
You can probably file a request in the Community Support area if you want to split points.
ASKER
I'm sorry - I meant to credit Khkremer - but I'd like to give a portion to Gns as he clarified some more. Tagish, I appologize - I did not intend to accept your answer. I appreciate your comment, but it doesn't deal with link count. I will post the point correction in community support.
I use ls -la at the command prompt. The results should be similar to the following: permisions owner group size date_created folder/file name -> folder/file name This is a symbolic link. The first folder/file name is the "linked" directory, the second folder/file name is the "original" folder or the one linked from. I think if it is a hard link the -> will become ->> but I am not 100% certain of the hard link symobol.