Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.


how to findout root symlink directory?

how to findout root symlink directory?


Thanks for looking at this.

I have a directory, which is a symlink

ex?ls -ld temp --> temporg2
ls -ld temporg2 --> temp_org

I would like to set temp_org to my final name based on temp.

Thanks in advance.

RE: how to findout root symlink directory?

use [file readlink name]

Bob Rashkin

RE: how to findout root symlink directory?

Thanks Bond,

It is only giving one level.

if there are 2 levels of links or 3 levels of links, i want the one which is very origin.

set var [file readlink $input] giving b when i pass input as a.

RE: how to findout root symlink directory?

if it is perl i can use below code

while (-l $input) {
$input = readlink($input)

then it will go till it doesn't find symlink.

But i am not sure how to do it in TCL.

please let me now if any of you have clues.

RE: how to findout root symlink directory?


Not much bigger theory neither in Tcl :

CODE --> Tcl

while {[file type $input]=="link"} {
set input [file readlink $input]


RE: how to findout root symlink directory?

Amazing, this is what I wanted.
thanks a ton Feherke.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close