I'm trying to create an OpenFilePikcker control in WPF and I use the DirectoryInfo.GetDirectories() to get all sub directories in a certain directory however in the case of Drive C:/ I do not want that method return the system directories like Windows and Program Files. How is that possible to do? Any help is appreciated.
Asked
Active
Viewed 105 times
1 Answers
1
you may need to filter them manually after you retrieve them using GetDirectories() as there is no native method available for such filter
you may use Environment.GetFolderPath
to retrieve some of the defined directory including those you look forward to filter out
eg
string sysDir = Environment.GetFolderPath(Environment.SpecialFolder.System);
and remove the directory from your list, and like wise look for all you are not interested in and remove them eg. Windows, ProgramFiles etc.
below is the available special folders which you might choose to refer too

pushpraj
- 13,458
- 3
- 33
- 50