List all files and directories in a directory + subdirectories
string[] allfiles = Directory.GetFiles(“path/to/dir”, “*.*”, SearchOption.AllDirectories); where *.* is pattern to match files If the Directory is also needed you can go like this: foreach (var file in allfiles){ FileInfo info = new FileInfo(file); // Do something with the Folder or just add them to a list via nameoflist.add(); }