Finding Bytes Transferred with Sync via Go Library

What is the problem you are having with rclone?

Trying to use the go library and find out the bytes transferred.

Specifically the Sync method found here: rclone/sync.go at master · rclone/rclone · GitHub

err = sync.Sync(ctx, dstFs, srcFs, false)

None of the methods I've seen return a bytes value but just a single error. Am I supposed to calculate that via the syncCopyMove interface? However, I don't think the interface or its attributes are exposed to do any calculation.

Run the command 'rclone version' and share the full output of the command.

Using the go library but using the latest version as of commit #e2afd00118ba2c34f123d045f054a52248afe2a7

Hi shenv56,

The functions found in sync.go aren't intended for external use and may change without notice.

I therefore recommend you take a look at the golang interface provided in librclone:

and perhaps first try playing with the rclone API to get acquainted with the possibilities:

You can then use one of these API commands to find the bytes transferred (during or after):

You will need to use the statistics to read the bytes transferred.

You can make a group for individual transfers if you want.

I've linked to the RC docs for these, but these have equivalent internal interfaces.

I don't recommend calling rclone methods directly as none of those interfaces are stable. Its better to use librclone which gives an in memory API interface.

( Edit: This answer crossed in the post with @Ole s answer, but we've said the same thing it appears :slight_smile: )

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.