| 

.NET C# Java Javascript Exception

2
Dim htmFile$() = System.IO.Directory.GetFiles("G:\avr", "*.htm",IO.SearchOption.TopDirectoryOnly)

In htmFile$() sind dann auch .html u.s.w gelistet,
wie kann das verhindert werden?
27.11.2017
1 Antwort
0
' Ich habe es jetzt so gemacht...
Dim Filter$ = "*.htm"
'Dim Filter$ = "*.htm?"
'Dim Filter$ = "*.htm*"
'
Dim DErw$ = System.IO.Path.GetExtension(Filter$)
Dim DErwLa% = DErw.Length
'
Dim FI() As FileInfo = New IO.DirectoryInfo("G:\AVR").GetFiles(Filter$, SearchOption.TopDirectoryOnly)
Select Case (DErw.Chars(DErw.Length - 1))
Case "*"
For Each File As FileInfo In FI
ListBox1.Items.Add (file.Name)
Next file
'
Case "?"
For Each file As FileInfo In FI
If file.Extension.Length <= DErwLa% Then ListBox1.Items.Add (file.Name)
Next file
'
Case Else
For Each file As FileInfo In FI
If file.Extension.Length = DErwLa% Then ListBox1.Items.Add (file.Name)
Next file
'
End Select
'
28.11.2017

Stelle deine System.io.directory.getfiles-Frage jetzt!