Skip to content

Instantly share code, notes, and snippets.

@a5ync
Created May 25, 2017 22:01
Show Gist options
  • Save a5ync/6085b54a1d38e9e090795c9194877fd9 to your computer and use it in GitHub Desktop.
Save a5ync/6085b54a1d38e9e090795c9194877fd9 to your computer and use it in GitHub Desktop.
public static IEnumerable<string> ListAllFiles(string path)
{
var directories = Directory.GetDirectories(path);
foreach (var directory in directories)
{
foreach (string x in ListAllFiles(directory))
{
yield return x;
}
}
var files = Directory.GetFiles(path);
foreach (var file in files)
{
yield return file;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment