I'm trying to get a list of all shared folders available on a local intranet server.
The System.IO.Directory.GetDirectories()
works fine for a path like \myServermyShare
, however I'm getting an exception for a path like \myServer
:
Unhandled Exception: System.ArgumentException: The UNC path should be of the form servershare.
Is there a way to get a list all shared folders for a server? Ultimately I'm looking for a method that can handle both scenarios based on a given path - returning a list of all shares for a given server and returning a list of all subdirectories for a given network shared folder.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…