views:

28

answers:

2

Is there's any simple way for identifying whether 2 (or more) paths point to the same location (assuming I only have read permissions)?

e.g. \My-Machine-Name\temp \212.200.10.5\temp c:\temp

+1  A: 

Assuming the file systems are NTFS, you can use the File System Serial Number (of the entire File System) and File ID (of that particular file/directory) to together represent a primary key for that file. With the understanding that you have a very statistically improbable chance of a hash collision, realistically if two files or directories share the same ID and FS serial number, they are identical.

I can't help you with your actual implementation since I do not know your development environment.

David Pfeffer
How can I query the remote machine's FS serial number?
Nissim
+1  A: 
  1. You want to convert your drives to UNC (universal naming convention) form. The WNetGetUniversalName function in the Windows API will convert a mapped drive to a UNC name. So c:\temp will be converted to \My-Machine-Name\temp.

  2. If you need to compare a UNC path with a hostname (like \My-Machine-Name) to an IP address, you can ping \My-Machine-Name to get its IP address.

Vanessa MacDougal