Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
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. –  quack quixote Feb 12 '10 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. –  Artem Russakovskii Mar 1 '10 at 17:23
add comment

2 Answers

up vote 0 down vote accepted

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.

share|improve this answer
add comment

One line powershell with Putty:

& "C:\Program Files (x86)\PuTTY\plink.exe" -l myself unix-host 'readlink /my/symlink'
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.