Synchronization Error

Advertisement

igor123
Guest

Synchronization Error

Hello.

There is a script that synchronizes the directory to a remote server. If files that can not be read are encountered during synchronization, the synchronization stops and the script ends. In the broad gulls:

Exception when calling "Check" with "0" arguments: Can't open file '***.DBF'.
System Error. Code: 32. The process can not access the file, since this file is occupied by another process

How can I skip such files so that the synchronization is not completed, but continued?

Found that in scripts you can use "option batch continue". But how to do this in the .NET assembly?

Thank you.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,286
Location:
Prague, Czechia

Re: Synchronization Error

igor123 wrote:

Found that in scripts you can use "option batch continue". But how to do this in the .NET assembly?
This mode is not supported in the assembly yet.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,286
Location:
Prague, Czechia

igor123 wrote:

That is, this error can not bypass?
Not with simple SynchronizeDirectories call.
You can of course implement the synchronization yourself with error handling you like. It's not difficult to implement with WinSCP .NET assembly.

Reply with quote

Advertisement

igor123
Guest

Thanks, but it's the same as calling the function SynchronizeDirectories(). And my problem is not solved in any way, because if the script can not copy the file, it will also give an error and stop working

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,286
Location:
Prague, Czechia

igor123 wrote:

Thanks, but it's the same as calling the function SynchronizeDirectories(). And my problem is not solved in any way, because if the script can not copy the file, it will also give an error and stop working
I do not understand what you mean by "same as calling the function SynchronizeDirectories()".
The script copies one file only, you need to modify it to copy more files.
You can combine the script with:
https://winscp.net/eng/docs/library_example_recursive_download_custom_error_handling

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,286
Location:
Prague, Czechia

Re: Synchronization Error

.NET assembly now supports custom error handling nativelly.
If you are interested in testing this functionality, send me an email, so I can send you back a development version of WinSCP. Please include link back to this topic in your email. Also note in this topic that you have sent the email. Thanks.

You will find my address (if you log in) in my forum profile.

Reply with quote

igor123
Joined:
Posts:
6

Re: Synchronization Error

martin wrote:

.NET assembly now supports custom error handling nativelly.
If you are interested in testing this functionality, send me an email, so I can send you back a development version of WinSCP. Please include link back to this topic in your email. Also note in this topic that you have sent the email. Thanks.

You will find my address (if you log in) in my forum profile.

Hello. I sent you a letter.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,286
Location:
Prague, Czechia

Re: Synchronization Error

igor123 wrote:

Hello. I sent you a letter.
I have responded.

Reply with quote

Advertisement

igor123
Joined:
Posts:
6

Sorry! Itself was mistaken.

Another question: what should be the code to enable this function? Such?

function func_sync {
$session.add_QueryReceived( { $_.Continue() } )
$synchronizationResult =
$session.SynchronizeDirectories([WinSCP.SynchronizationMode]::Remote, $args[0], $args[1], $True)

# Throw on any error
$synchronizationResult.Check()
}

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,286
Location:
Prague, Czechia

igor123 wrote:

Another question: what should be the code to enable this function? Such?
Sorry, I do not understand, what you mean by "enable this function".

Reply with quote

igor123
Joined:
Posts:
6

martin wrote:

igor123 wrote:

Another question: what should be the code to enable this function? Such?
Sorry, I do not understand, what you mean by "enable this function".

To enable the "continue on error mode"

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
28,286
Location:
Prague, Czechia

OK, so you were asking, if your code is correct? Yes, it's look good to me.

Reply with quote

igor123
Joined:
Posts:
6

martin wrote:

OK, so you were asking, if your code is correct? Yes, it's look good to me.

No. In the previous version WinSCP reached the occupied file and if WinSCP could not copy it, WinSCP stopped working and gave an error. In the new version of WinSCP it comes to this file and hangs. And the error does not give out and the work does not stop. What to do?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
28,286
Location:
Prague, Czechia

igor123 wrote:

No. In the previous version WinSCP reached the occupied file and if WinSCP could not copy it, WinSCP stopped working and gave an error. In the new version of WinSCP it comes to this file and hangs. And the error does not give out and the work does not stop. What to do?
I've found a bug that causes the session to hang, if you set QueryReceived after calling Open.
https://winscp.net/tracker/1600

Before the fix is released, just move add_QueryReceived before Open.

Reply with quote

Advertisement

You can post new topics in this forum