PutFiles removes source file even though transfer fails

Advertisement

ronnie.petersen
Joined:
Posts:
1
Location:
Denmark

PutFiles removes source file even though transfer fails

I'm using winscp\5.15.9.0\lib\WinSCPnet.dll in some PowerShell scripts.
Usually it works perfect, but recently I have experienced that the source file is missing/removed after a failed transfer.

Here the pretty straight forward code:
$transferResult = $session.PutFiles($file, $destination, $true, $transferOptions);
foreach ($transfer in $transferResult.Transfers) {
    if ($transfer.Error -eq $null) {
        write "$now INFO upload of $($transfer.FileName) succeeded";
    }
}
$void=$transferResult.Check();
Here's the error I get is:
Error transferring file 'C:\<filename>.xml'. Copying files to remote side failed. Server busy. Please try again later.
Connection failed. Disconnected from server Connection failed. Server busy. Please try again later.
After this the source file is gone?

Any clues?

NB: For now I have changed the bool remove flag to $false, and I move the file in a separate command. But still it should work with the remove flag set.

Br,
Ronnie

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,454
Location:
Prague, Czechia

Re: PutFiles removes source file even though transfer fails

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

To generate the session 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.

Reply with quote

Advertisement

You can post new topics in this forum