.net - Search for a file in a specific directory C# -


i attempting(without luck) search specific file if exist in particular directory.

for example: search test.txt if resides within directory structure of testfolder(does not have in testfolder have in 1 of subfolders of testfolder). location of testfolder not known.

i have tried this, errors out when hits dir not have access too.

string[] list = directory.getdirectories("c://", "testfolder", searchoption.alldirectories); 

the though find directory , search within directory file.

any appreciated!

the way describe should work (i.e. find directories , search within them).

most got "unauthorizedaccessexception" exception related security system in windows 7.

i suggest add try-catch skip folder can't access


Comments

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -