Is the file on a network share?

  • Thread starter Thread starter Anders K. Olsen
  • Start date Start date
A

Anders K. Olsen

Hello group

Is there any way to tell, if a file is on a network share?

I know the path to the file, so I can easily get a FileInfo object, and I
can also use the Path class. However I can't find any way to use this
information to determine if the file is on a local disk, or on a mapped
network drive.

I'm asking, because I'm trying to enumerate all security groups that have
read access to the file. I can do this, but some of the groups can belong to
the build in domains, e.g. BULTIN\Users, and I need to know if this is the
Users group on a local computer, or the Users group on the file server. So
if you can help me do this translation instead, that would be perfect.

Thank you for your help

Regards
Anders
 
Hi,

Anders K. Olsen said:
Hello group

Is there any way to tell, if a file is on a network share?

I know the path to the file, so I can easily get a FileInfo object, and I
can also use the Path class. However I can't find any way to use this
information to determine if the file is on a local disk, or on a mapped
network drive.

I really don't know if you can do this in managed code, there are two
options that I know of in unmanaged code:

1- Using WMI

2- Using GetDriveType win32 API call

It should be fairly trivial P/invoke it , so I would go that route
 
Back
Top