Topic "Download content not same as source file"

Author Message
weh
[View user's profile]

Joined: 2017-07-11
Posts: 5
The powershell script in https://winscp.net/eng/docs/library_session_synchronizedirectories have been used to synchronize the files in destination folder with the remote location. Recently there are few cases which the content in destination folder does not match with remote location. Example the source file in remote location has 20 lines but the file in destination location content the first 10 lines twice and the remaining 10 lines at the end of the source file were missing in the destination file. Just suspect it might due to connection disconnect before download complete and issue occur when connection resume. How to change the script so that the files in destination location will be overwrite when connection issue happen instead of resume using powershell script? Or any other suggestion on how to fix this issue?
Advertisements
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26728
Location: Prague, Czechia
What protocol are you using? Do you have any log file showing what did really happen?
weh
[View user's profile]

Joined: 2017-07-11
Posts: 5
martin wrote:
What protocol are you using? Do you have any log file showing what did really happen?


I am using SFTP with private key. File attached
Sync.log (20.25 KB) Private file

Description: (none)

martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26728
Location: Prague, Czechia
Thanks for the log.

I do not see anything wrong on WinSCP side. What SFTP server is that? It pretends to be OpenSSH, but clearly it's not. At least not any official OpenSSH build.

Are you able to reproduce the problem? If you are, can you send us log file on level Debug 2?
weh
[View user's profile]

Joined: 2017-07-11
Posts: 5
That is SFTP server provide by client. It not happen all the time, only when connection issue happen during the download which show in the log. How to turn on level Debug 2?

. 2017-07-15 14:00:42.501 Waiting for data timed out, asking user what to do.
. 2017-07-15 14:00:42.501 Asking user:
. 2017-07-15 14:00:42.501 **Host is not communicating for 15 seconds.
. 2017-07-15 14:00:42.501
. 2017-07-15 14:00:42.501 Wait for another 15 seconds?** ()
< 2017-07-15 14:00:42.501 Script: Host is not communicating for more than 15 seconds.
< 2017-07-15 14:00:42.501 Still waiting...
< 2017-07-15 14:00:42.501 Note: If the problem repeats, try turning off 'Optimize connection buffer size'.
< 2017-07-15 14:00:42.501 Warning: Aborting this operation will close connection!
. 2017-07-15 14:01:43.847 Attempt to close connection due to fatal exception:
* 2017-07-15 14:01:43.847 **Terminated by user.**
. 2017-07-15 14:01:43.847 Closing connection.
. 2017-07-15 14:01:43.847 Sending special code: 12
. 2017-07-15 14:01:43.847 Sent EOF message
. 2017-07-15 14:01:43.847 Connection was lost, asking what to do.
. 2017-07-15 14:01:43.847 Asking user:
. 2017-07-15 14:01:43.847 Terminated by user. ()
< 2017-07-15 14:01:43.847 Script: Terminated by user.
< 2017-07-15 14:01:48.925 Script: Searching for host...
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26728
Location: Prague, Czechia
weh wrote:
How to turn on level Debug 2?

https://winscp.net/eng/docs/ui_pref_logging
weh
[View user's profile]

Joined: 2017-07-11
Posts: 5
Currently when run the powershell script $session.DebugLogLevel = 2 to turn on debug level 2 in version 5.7.6, it will return below error
"Specified argument was out of the range of valid values.
Parameter name: Logging level has to be in range 0-1"

When upgrade to version 5.9.6, it will return below error
"Cannot find type [WinSCP.SessionOptions]: verify that the assembly containing this type is loaded."
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26728
Location: Prague, Czechia
Sorry, I've forgot that you are using the assembly.

weh wrote:
When upgrade to version 5.9.6, it will return below error
"Cannot find type [WinSCP.SessionOptions]: verify that the assembly containing this type is loaded."

I do not see, how an upgrade could have caused this. To help you, we need to know more about your script. How do you load the assembly? Is this really the first error, that your script issues? Isn't there some error earlier, when attempting to load the assembly? Where do you have the assembly stored?
weh
[View user's profile]

Joined: 2017-07-11
Posts: 5
Windows task scheduler has been setup to invoke the powershell script which similar to https://winscp.net/eng/docs/library_session_synchronizedirectories. Attached is the script which server name and authentication has been remove

For the new version, after unzip the file, I copy over all the files for the new version and replace the existing files in the folder D:\Program Files (x86)\winscp576automation that powershell script refer.

Only below lines can be found in the log file
[07/25/2017 17:36:33] Sync Started
[07/25/2017 17:36:33] Cannot find type [WinSCP.SessionOptions]: verify that the assembly containing this type is loaded.
[07/25/2017 17:36:33] Sync Stopped

Just thought of may be the new version will have resolve the content download issue, so would like to upgrade, monitor and verify
SFTP_Retrieve.txt (4.06 KB) [Download]

Description: (none)

martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26728
Location: Prague, Czechia
As Add-Type is not within try .. catch your log file won't contain its errors.

Make sure you redirect an output of PowerShell to another log file to see error that the Add-Type most probably issues.

Note that you path still refers to winscp576automation, while you claim to have upgraded to 5.9.6.
Advertisements

You can post new topics in this forum

Search

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