• 0

Finding symlink path (cross-platform)


Question

I have a network location where several directories are located. We'll say that they look like this (in UNIX-style):

/dir/dir1

/dir/dir2

/dir/dir3

/dir/dir4

and so on.

Now, there's one directory that will appear as /dir/NEWDIR, which is actually just a symlink to one of the others (so maybe it links to /dir/dir4 in this case).

This location is also accessible on Windows (maybe as \\server\dir\dir1, etc.).

I'm wondering if there is a way to determine which directory the NEWDIR link actually links to in a script. I would prefer to do this in Perl to integrate with something else I'm doing. I need to do this on multiple platforms (Windows and Linux, possibly Sun, which I imagine would be similar to Linux). In fact, I even managed to get "readlink" in Perl to work on Linux, but it just returns nothing when I try it on Windows.

Any ideas on a good solution here? Even if I have to use one solution for Linux/UNIX-style platforms, and another for Windows, this might be acceptable.

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.