Hallo,
diese Funktion ist etwas weiter unten beim "Community Content" zu finden.
Ist zwar VB.net ist aber in einer minute umgeschrieben.
Public Function GetFileList(ByVal StartsWith As String, ByVal EndsWith As String) As List(Of String)
Dim oFTP As FtpWebRequest = CType(FtpWebRequest.Create(FTPSite & CurrentDirectory), FtpWebRequest)
oFTP.Credentials = New NetworkCredential(UserName, Password)
oFTP.KeepAlive = KeepAlive
oFTP.EnableSsl = UseSSL
If UseSSL Then ServicePointManager.ServerCertificateValidationCallback = New RemoteCertificateValidationCallback(AddressOf ValidateServerCertificate)
oFTP.Method = WebRequestMethods.Ftp.ListDirectory
Dim response As FtpWebResponse = CType(oFTP.GetResponse, FtpWebResponse)
Dim sr As StreamReader = New StreamReader(response.GetResponseStream)
Dim str As String = sr.ReadLine
Dim oList As New List(Of String)
While str IsNot Nothing
If str.StartsWith(StartsWith) And str.EndsWith(EndsWith) Then
oList.Add(str)
End If
str = sr.ReadLine
End While
sr.Close()
response.Close()
oFTP = Nothing
Return oList
End Function
sg