Possible Duplicate:
Best way to determine if two path reference to same file in C#
There are several ways to specify a directory location.
For example:
\\machineName\c$\rootPath\subPath
\\machineName\shareName (share pointing to subPath)
C:\rootPath\subPath
subPath (relative path if already in C:\rootPath
I need to determine that all of these paths “equal” each other (are really the same physical location on the hard drive).
Is there any way I can do this in C#?
As Oded states this is tricky to do in .Net. You could possibly cheat (depening on your exact requirements and permissions etc) by writing a file with a long randomly generated filename to the location and then seeing if you can see it from the other location. Bit of a hack but this is a pretty sound test I think, rather than relying on resolving mapped drives etc etc.
Ok many apologies for the VB – it’s all I’ve got on this tiny netbook… C# wouldn’t be too different…
usage eg
If sameLocation("\\machineName\c$\rootPath\subPath","\\machineName\shareName") Then...You could add more security, ie reading the timestamp etc…