Using Directory.GetDirectories
to get all the folder name in specified directory, then traverse it and write to .txt file.
The code snippet as following:
string yol = "isimler.txt";
System.IO.StreamWriter zzz = new System.IO.StreamWriter(yol);
string[] lines = Directory.GetDirectories(@"C:\");
foreach(string name in lines)
zzz.WriteLine(name);
zzz.Close();
4
solved Get Folder names into txt file in C# [closed]