+1 vote
by (390 points)

I can't seem to find the difference with SftpTransferProgressChangedEventArgs.CurrentFileBytesTransferred and SftpTransferProgressChangedEventArgs.BytesTransferred. Can someone explain please?

1 Answer

0 votes
by (58.9k points)
selected by
Best answer

The TransferProgressChanged event is used for single file operations (PutFile, GetFile, etc.) but also for the multi-file operations (Upload, Download) that can transfer multiple files with one method call.

The CurrentFileBytesTransferred property "Gets the total number of bytes transferred during the transfer of the current file." So in case of multi file operation this property gets reset with each new file transfer.

whereas the BytesTransferred property "Gets the total number of bytes transferred.", i.e. here it is counting all bytes of all transferred files together.

Consequently, for the singe-file operations, the CurrentFileBytesTransferred and
BytesTransferred properties yield the same results which might seem to be strange, but it is correct and you will only notice the different behavior with the advanced multiple file operations.

by (390 points)
thank you :) that clear evertyhing
by (58.9k points)
good, thanks! :)