- weh
- Joined:
- Posts:
- 5
Download content not same as source file
Advertisement
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?
Advertisement
-
martin◆
Site Admin - Joined:
- Posts:
- 41,517
- Location:
- Prague, Czechia
Re: Download content not same as source file
What protocol are you using? Do you have any log file showing what did really happen?
- weh
- Joined:
- Posts:
- 5
Re: Download content not same as source file
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
-
martin◆
Site Admin - Joined:
- Posts:
- 41,517
- Location:
- Prague, Czechia
Re: Download content not same as source file
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?
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
- Joined:
- Posts:
- 5
Download content not same as source file
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...
. 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...
Advertisement
-
martin◆
Site Admin
Re: Download content not same as source file
https://winscp.net/eng/docs/ui_pref_loggingHow to turn on level Debug 2?
- weh
- Joined:
- 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."
"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◆
Site Admin - Joined:
- Posts:
- 41,517
- Location:
- Prague, Czechia
Sorry, I've forgot that you are using the assembly.
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?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."
- weh
- Joined:
- Posts:
- 5
Download content not same as source file
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
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
Advertisement
-
martin◆
Site Admin - Joined:
- Posts:
- 41,517
- Location:
- Prague, Czechia
Re: Download content not same as source file
As
Make sure you redirect an output of PowerShell to another log file to see error that the
Note that you path still refers to
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.
Advertisement
You can post new topics in this forum