private List<string> GetAllFiles(string path, string ext)
{
List<string> fileList = new List<string>();
if (!Directory.Exists(path))
{
return fileList;
}
string[] files = Directory.GetFiles(System.IO.Path.GetFullPath(path).ToString());
for (int i = 0; i < files.Length; i++)
{
if (string.Equals(System.IO.Path.GetExtension(files[i]), ext))
{
fileList.Add(files[i]);
}
}
string[] dirs = Directory.GetDirectories(System.IO.Path.GetFullPath(path).ToString());
if (dirs == null || dirs.Length == 0)
{
return fileList;
}
for (int i = 0; i < dirs.Length; i++)
{
fileList.AddRange(GetAllFiles(dirs[i], ext));
}
return fileList;
}