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

mariant

Re: PutFiles / Check ends up uploading files multiple times

Hi,

I am attaching here the session log.
It is the entire log generated while I was trying to upload a 74 KB file.
There seems to be a "Network error: Software caused connection abort".

The log I generate inside my code does not capture an error.

These are some lines from the log I generate:
2019-03-28 12:20:12.668 | Connect to WinSCP.

2019-03-28 12:20:16.944 | Try upload all files in Outbox folder...
2019-03-28 12:20:37.732 | ...Done
2019-03-28 12:20:37.741 | Uploaded Files: 1, Files Failed: 0


And this is the relevant code that produces the above 4 lines of log.
// Connect

Add2Log("Connect to WinSCP.");
session.Open(sessionOptions);

// Upload files
TransferOptions transferOptions = new TransferOptions();
transferOptions.TransferMode = TransferMode.Automatic;
transferOptions.PreserveTimestamp = false;
transferOptions.ResumeSupport.State = TransferResumeSupportState.Off;

TransferOperationResult transferResult;

Add2Log("Try upload all files in Outbox folder...");
transferResult = session.PutFiles(
      outboxFolder + "*"
    , remoteFolder
    , false
    , transferOptions
  );
// Throw on any error
transferResult.Check();
Add2Log("...Done");
Add2Log(string.Format(
     "Uploaded Files: {0}, Files Failed: {1}"
    , transferResult.Transfers.Count
    , transferResult.Failures.Count
  ));


Thanks
martin

Re: PutFiles / Check ends up uploading files multiple times

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.
mariant

PutFiles / Check ends up uploading files multiple times

Hi there,

This might be a server-side-caused-problem, but ...

I have a process where I upload files on SFTP protocol and then check for errors.
The files are in a Outbox folder when picked up by PutFiles.... then I call the Check().
From the transferResult.Transfers collection I take file by file and create my log and move the files to an Archive folder.
Everything works fine on my side, but on the server side, a file looks like it is uploaded multiple times ("they" have a log showing multiple uploads), and that might be because the destination file gets picked up "too quick" before my process ends.

Can someone explain why/how PutFiles works and why is re-uploading files?
As a note, the ResumeSupport is set to off.


Thanks