Thalia
Thalia

Reputation: 14615

GetDirectories from network in c#

I am trying to create a listing of folders on the system (actually I am trying to make a custom "explorer").

I need to be able to list network drives, but I don't know how.

The only thing I know how to do is:

string[] localDrives = Directory.GetLogicalDrives();

If I even try

string[] initDrives = Directory.GetDirectories(initialDirectory);

where initialDirectory is anything, from

initialDirectory = Directory.GetCurrentDirectory();

to a network drive (I thought I can, in a worst case scenario, hard-code a path with \\), the string[] remains null.

How can I get a list of all the paths available, or the directories and subdirectories given a path that could be on the network ?

Upvotes: 2

Views: 2645

Answers (1)

Adil
Adil

Reputation: 148110

This codeproject article may help you http://www.codeproject.com/Articles/20547/How-to-Browse-Network-Folders-using-Folder-Dialog

Upvotes: 2

Related Questions