Very Large folder getting Timeout waiting for WinSCP to respond

Advertisement

LinQon
Donor
Joined:
Posts:
3

Very Large folder getting Timeout waiting for WinSCP to respond

I've created a PowerShell script that works as expected copying files from a folder with <35K files.
However, WinSCP aborts after 65 seconds using the same script to copy files from a different folder (with >120K files) on the same SFTP server.

I have tried doubling the timeout to:
TimeoutInMilliseconds = 120000

The error message I get on failure is:
Exception calling "GetFiles" with "2" argument(s): "Timeout waiting for WinSCP to respond"
At E:\Scripts\MOS_DL.ps1:28 char:5
+     $session.GetFiles($SelectFiles, "E:\ITS_Archives\MOS\*").Check()
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : TimeoutException

Is there a way to increase the WinSCP timeout when reading a ridiculous number of files in a folder or is something else occurring?

Using WinSCP 5.9.4 on Windows Server 2008
Session & Debug logs attached
Description: Debug Log
Description: Session Log

Reply with quote

Advertisement

LinQon
Donor
Joined:
Posts:
3

Re: Very Large folder getting Timeout waiting for WinSCP to respond

martin wrote:

You have to set the Session.Timeout:
https://winscp.net/eng/docs/library_session#timeout

Thanks,
I've changed my $SessionOptions from using TimeoutInMilliseconds to the Timeout command. I must not be using it right as it still aborts after 65 seconds.

I've attached my script, would you be able to help me correct it?

Thanks
  • DL-Script.txt (1.04 KB, Private file)
Description: Powershell script

Reply with quote

martin
Site Admin
martin avatar

Re: Very Large folder getting Timeout waiting for WinSCP to respond

Not SessionOptions.Timeout! Use Session.Timeout!

Reply with quote

LinQon
Donor
Joined:
Posts:
3

Re: Very Large folder getting Timeout waiting for WinSCP to respond

martin wrote:

Not SessionOptions.Timeout! Use Session.Timeout!

Perfect, that fixed it.
Thank you.

Reply with quote

Advertisement

You can post new topics in this forum