Autor Beitrag
ottto
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20



BeitragVerfasst: Fr 28.11.14 16:14 
Hallo,
mit
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
DirectoryInfo verz1 = new DirectoryInfo(@"C:\Ablage\");
foreach (FileInfo f in verz1.GetFiles())
{
    Console.WriteLine(f.Name);
}

kann ich die Dateien aus einem Verzeichnis auslesen und anzeigen.
Gibt es eine Möglichkeit nur bestimmte Dateien (*.txt) einzulesen?
Ich könnte bei der Ausgabe filtern, beim einlesen wäre aber sicher besser.
Danke.
ottto

Moderiert von user profile iconTh69: Quote- durch C#-Tags ersetzt
Ralf Jansen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 4701
Erhaltene Danke: 991


VS2010 Pro, VS2012 Pro, VS2013 Pro, VS2015 Pro, Delphi 7 Pro
BeitragVerfasst: Fr 28.11.14 16:29 
ausblenden C#-Quelltext
1:
foreach (FileInfo f in verz1.GetFiles("*.txt"))					


Guckst du dir eine der anderen beiden Überladungen von GetFiles an
ottto Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20



BeitragVerfasst: Fr 28.11.14 16:54 
Passt!
Vielen Dank für die schnelle Antwort.
Gruß.
ottto