Hi Friends.......
How can we tell whether a given file is a directory and how can we list all files in a directory including subfolders?
Thanks........
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Dec 12, 2011, 1:49 PM
if (Directory.Exists(fileName))
{
// it's a directory
}
To get an array of all files in a directory and its subdirectories:
string[] fileNames = Directory.GetFiles(directoryPath, "*.*", SearchOption.AllDirectories);
Vikas MishraPosted Dec 14, 2011, 6:04 PM