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........
File Is A Directory
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


VulpesRank #55 · 29.2K reputationPosted Dec 12, 2011, 8:49 AM EST
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 MishraRank #559 · 4.3K reputationPosted Dec 14, 2011, 1:04 PM EST