I am using this code to search all directories in all drives to search for all .txt files:
public List Search()
{
var files = new List
The problem here is that some files you don't have control on it to get access it's files. So you need to use try{ } catch{ }
. But i think you can't handle this while processing the whole file system directories at once. SO you need to first get list of all directories then process each directory at once at while you are processing specific directory files you can handle that kind of exception.
Kindly check this:
unauthorizedaccessexception-cannot-resolve-directory-getfiles-failure