Suppose you have the full path to an available file or folder in the system. How can I get some unique identifier of the physical device on which the file (or folder) is actually located?
My first attempt was to use System.IO.DriveInfo, which depends on the presence of a drive letter. But UNC paths and multiple network drives mapped to the same physical device on the server add some complexity. For example, these 3 paths point to the same folder on the same device.
\\myserver\users\brian\public\music\
s:\users\brian\public\music\ (here s:\ is mapped to \\myserver\)
u:\public\users\music\ (here u:\ is mapped to \\myserver\users\brian\)
Ultimately, my goal is to take these few paths and report the amount of free and free disk space on each device. I want to combine these 3 paths into one element in the report, not 3 separate elements.
Is there any Windows API that can help find this information in any arbitrary full path?
source
share