-
public static IEnumerable<FileInfo> getFiles(DirectoryInfo d)
-
{
-
return getFiles(d, "*.*");
-
}
-
-
/// <summary>
-
/// method for recursively getting all the files
-
/// in the provided directory
-
/// </summary>
-
/// <param name="d">DirectoryInfo we're looking at</param>
-
/// <param name="pattern">search patters (i.e; *.*)</param>
-
/// <returns></returns>
-
public static IEnumerable<FileInfo> getFiles(DirectoryInfo d, string pattern)
-
{
-
//loop through the entire directory
-
foreach (DirectoryInfo dirInfo in d.GetDirectories())
-
{
-
//loop through each file
-
foreach (FileInfo f in getFiles(dirInfo, pattern))
-
yield return f;
-
}
-
-
foreach (FileInfo f in d.GetFiles(pattern))
-
yield return f;
-
}