I am currently developing a VB.NET application and I wanted to list out all txt file today’s file available in SFTP folder. The application uses Winscp.dll (version 220.127.116.11).
I am passing *.txt along with the sftp path to ListDirectory method
It downloads all files available in the /Test/ folder with .txt extension, then I am looping through each file and checking the file date time and filtering today’s file.
I found there is a Mask feature where we can specify the date time.
Matches files modified the last time after the date or time (i.e. “newer than”).
But when I pass the File Mask to List Directory method, it is not supported.
I believe I am missing some points here, please help.
Imports WinSCP Try Dim sessionOptions As New SessionOptions With sessionOptions .Protocol = Protocol.Sftp .HostName = HostName .PortNumber = PortNumber .UserName = UserName .Password = Password .SshHostKey = SSHHostKey End With Using session As Session = New Session session.Open(sessionOptions) Dim directory As RemoteDirectoryInfo = session.ListDirectory("/Test/*.txt>2014-02-21") ... End Using Catch e As Exception WriteInLogFile("Error : " & e.Message.ToString) End Try
WinSCP 5.0.6 (Build 2074)
Kindly note that I don’t want to download the file.