.net - Search for a file in a specific directory C# -
this question has answer here:
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
Post a Comment