Tôi có một số mã:Chỉ liệt kê các SubFolders trong C#?
string pathUser = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
string pathDownload = Path.Combine(pathUser, @"documents\iracing\setups\");
DirectoryInfo dinfo = new DirectoryInfo(pathDownload); // Populates field with all Sub Folders
FileInfo[] Files = dinfo.GetFiles("*.sto");
foreach (FileInfo file in Files)
{
listBox2.Items.Add(file.Name);
}
Tôi muốn các thư mục con của: documents\iracing\setups\
được hiển thị, không phải các tập tin ... bao gồm cả các tập tin .sto. Tất cả những gì tôi cần là liệt kê các thư mục con .... tôi không biết làm thế nào để làm điều đó? Cảm ơn!
Tôi sẽ làm thế nào để điền vào listbox2 của tôi với các thư mục con này? –
Hoàn hảo! Tahanks !! –