string get_path = textBox1.Text.Trim();
if (get_path != ""){
DirectoryInfo di = new DirectoryInfo(get_path);
FileInfo[] get_files = di.GetFiles("*.*"); // *.* = tüm ad ve tüm uzantıları kapsar
foreach (FileInfo file in get_files){
listBox1.Items.Add(file.Name);
}
}else{
MessageBox.Show("Lütfen dosya yolu belirtiniz.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
using System.IO;
string exePath = System.Reflection.Assembly.GetExecutingAssembly().Location; // Uygulamanın .exe dosyasının konumunu al
string folderPath = System.IO.Path.GetDirectoryName(exePath); // .exe dosyasının dosya konumu elde et
DirectoryInfo dosya = new DirectoryInfo(@folderPath); // Klasörü dosyaya cast et
FileInfo[] Dosyalar = dosya.GetFiles("*"); // Tüm dosya tiplerini dahil et
foreach (FileInfo file in Dosyalar) // Hepsini konsola yazdır
{
Console.WriteLine(file);
}
string get_path = textBox1.Text.Trim();
if (get_path != ""){
DirectoryInfo di = new DirectoryInfo(get_path);
FileInfo[] get_files = di.GetFiles("*.*"); // *.* = tüm ad ve tüm uzantıları kapsar
foreach (FileInfo file in get_files){
listBox1.Items.Add(file.Name);
}
}else{
MessageBox.Show("Lütfen dosya yolu belirtiniz.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
Anladım hocam. Teşekkür ederim.
Hocam peki bilgisayardaki butun dosyalar nasıl gosterilir?
string[] files = Directory.GetFiles(@"C:\", "*.*", SearchOption.AllDirectories);
Bu sitenin çalışmasını sağlamak için gerekli çerezleri ve deneyiminizi iyileştirmek için isteğe bağlı çerezleri kullanıyoruz.