Topic "Terminated by User error and check for functionality"

Author Message
Parag Bangar
[View user's profile]

Joined: 2015-07-01
Posts: 2
Location: India
Hello,

We are using the WinScp dll with one of our .Net application for Moving/Putting/Deleting the files from specific servers.
I would appreciate to have the prompt response to below two queries:

1. At a few times a day it sends us "Terminated by User" error.
FYI, one instance of connection is being closed before creating the new one for next task.
There is nothing with code i feel here, something related to WinScp utility itself is aborting this.
What could be the reason and is there any way to track/debug the same ?

2. Is there any way from where we can list out the latest files from a directory ? Currently we are using RemoteDirectoryInfo.GetListOfFiles() which provides us all the files from a particular directory but I want to list out those which are new ones i.e. uploaded on the directory in last 3 days.

Let me know your suggestions on the same.

Thanks in Advance.

Parag Bangar
E : parag.bangar@ge.com
M : +91-7600701624
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
Quote:
1. At a few times a day it sends us "Terminated by User" error.
FYI, one instance of connection is being closed before creating the new one for next task.
There is nothing with code i feel here, something related to WinScp utility itself is aborting this.
What could be the reason and is there any way to track/debug the same ?


Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

Quote:
2. Is there any way from where we can list out the latest files from a directory ? Currently we are using RemoteDirectoryInfo.GetListOfFiles() which provides us all the files from a particular directory but I want to list out those which are new ones i.e. uploaded on the directory in last 3 days.

There's no RemoteDirectoryInfo.GetListOfFiles.
How to filter the file list depends on a language you are using.
Parag Bangar
[View user's profile]

Joined: 2015-07-01
Posts: 2
Location: India
prikryl wrote:
Quote:
1. At a few times a day it sends us "Terminated by User" error.
FYI, one instance of connection is being closed before creating the new one for next task.
There is nothing with code i feel here, something related to WinScp utility itself is aborting this.
What could be the reason and is there any way to track/debug the same ?


Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

We just have to provide the path of the blank text file where we want the logs , right?

Quote:
2. Is there any way from where we can list out the latest files from a directory ? Currently we are using RemoteDirectoryInfo.GetListOfFiles() which provides us all the files from a particular directory but I want to list out those which are new ones i.e. uploaded on the directory in last 3 days.

There's no RemoteDirectoryInfo.GetListOfFiles.
How to filter the file list depends on a language you are using.



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;
}
}
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
Quote:
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.

Quote:

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));
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License