I am a vb.net newbie and I am trying to write a code that when executed pulls the latest file on an FTP server (based on creation date). So far, I've been able to list all the files in the remote directory. I know this can be done using regular expressions but unfortunately, I have no idea of how to implement that inside a code. So, any help is appreciated.
Regular expression to get the oldest file
My progress so far.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim ftpRequest As FtpWebRequest = DirectCast(WebRequest.Create("ftp://ftp.sitename.com/logs"), FtpWebRequest) ftpRequest.Method = WebRequestMethods.Ftp.ListDirectoryDetails ftpRequest.Credentials = New NetworkCredential("username", "password") Dim ftpResponse As FtpWebResponse = DirectCast(ftpRequest.GetResponse(), FtpWebResponse) Dim ftpResponseStream As Stream = ftpResponse.GetResponseStream() Dim ftpReader As New StreamReader(ftpResponseStream) Console.WriteLine(ftpReader.ReadToEnd()) MsgBox("Directory List Complete...!") ftpReader.Close() ftpResponse.Close() End Sub