This one might be a bit tricky.

I have a samba mount in Windows, mounted from a local Linux devbox. The projects on this mount contain a lot of symlinked directories. They all work fine and look like normal directories to Windows. What I'd like to do is figure out for a given file what its real UNIX path is.

The context is: in my editor I have a script that runs the Perforce open command, to which I pass the file location.

p4.exe edit FILE_LOCATION

However, perforce will not understand this FILE_LOCATION, if on the Linux side part of the path is a symlink. It needs to know the real path.

What I need is something along the lines of the Linux readlink command, which resolves symlinks in paths.

If anyone ever solved this problem, I'd appreciate if you could share it with us.

Thank you.

  • have you actually tried passing it the file location that Windows sees (including the symlink)? what happens? i've never had any trouble accessing files-that-are-really-symlinks from a Windows-mounted Samba share; to the best of my knowledge, Samba hides the fact that it's a symlink. Feb 12, 2010 at 8:01
  • ~quack, I can access them just fine but Perforce, when presented with this path, doesn't resolve symlinks, and just says that it doesn't know anything about that file. Mar 1, 2010 at 17:23

2 Answers 2


For the moment, I created a script that SSHes to the devbox from my IDE and runs the p4 edit command using readlink. It's only possible because PHPEd (my IDE) allows running commands on the current file, and my SSH client (SecureCRT) allows running scripts once it logs in. This is not optimal but an acceptable workaround in the meantime.


One line powershell with Putty:

& "C:\Program Files (x86)\PuTTY\plink.exe" -l myself unix-host 'readlink /my/symlink'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .