Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

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.
ronnie.petersen

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