Re: Terminated by User error and check for functionality
We just have to provide the path of the blank text file where we want the logs , right?
The file does not need to exist.
We are using Ftp methods of winscp.dll with C# code.
Below is the function which provides the list of the files from a particular Ftp location.
What i want is : get the latest uploaded files from this location instead of getting all the files residing there.
public static RemoteDirectoryInfo GetListOfFiles()
{
try
{
RemoteDirectoryInfo remoteDirectory;
SessionOptions sessionOptions = new SessionOptions();
sessionOptions.Protocol = Protocol.Sftp;
sessionOptions.HostName = strPickupFTPHost;
sessionOptions.UserName = strPickupFTPUserName;
sessionOptions.Password = strPickupFTPPassword;
sessionOptions.PortNumber = intPickupPortNumber;
sessionOptions.SshHostKeyFingerprint = strPickupSshHostKey;
if (sessionOptions.Password == null || sessionOptions.Password == "")
{
sessionOptions.SshPrivateKeyPath = strPickUpSshPrivateKeyPath;
}
using (Session session = new Session())
{
session.Open(sessionOptions);
remoteDirectory = session.ListDirectory(clsUtility.strFilePickupLocation);
session.Dispose();
}
return remoteDirectory;
}
}
In C# use:
IEnumerable<RemoteFileInfo> lastestFiles = dir.Files.Where(file => file.LastWriteTime > DateTime.Now - TimeSpan.FromDays(3));