Hyun
Hyun

Reputation: 37

C# getdirectories().Length UnauthorizedAccessexception

Using 'Directory.GetDirectories().Length'

Except for an UnauthorizedAccessexception folder, How can I get the number of folders? I would like to get only the number of Accessible folder.

sorry, I can't speaking english well.

Upvotes: 2

Views: 198

Answers (1)

Ashok Patel
Ashok Patel

Reputation: 120

using Directory.GetDirectories() you can get a list of directories and then check permission for each directory and if it's allowed than take one counter for a number of the accessible folders.

To check permission on folder go to the following link. Visit Checking for directory and file write permissions in .NET

Upvotes: 2

Related Questions