"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
Change byte unit format from MiByte to MiB
albertonyf1f923a986ca
diff --git a/backend/dropbox/dropbox.go b/backend/dropbox/dropbox.goindex c007d0b33..70bd15181 100755--- a/backend/dropbox/dropbox.go+++ b/backend/dropbox/dropbox.go@@ -66,7 +66,7 @@ const (//// Speed vs chunk size uploading a 1 GiB file on 2017-11-22//- // Chunk Size MiB, Speed MiByte/s, % of max+ // Chunk Size MiB, Speed MiB/s, % of max// 1 1.364 11%// 2 2.443 19%// 4 4.288 33%diff --git a/cmd/about/about.go b/cmd/about/about.goindex 931fc2724..560526131 100644--- a/cmd/about/about.go+++ b/cmd/about/about.go@@ -51,11 +51,11 @@ output. The output is typically used, free, quota and trash contents.E.g. Typical output from ` + "`rclone about remote:`" + ` is:- Total: 17 GiByte- Used: 7.444 GiByte- Free: 1.315 GiByte- Trashed: 100.000 MiByte- Other: 8.241 GiByte+ Total: 17 GiB+ Used: 7.444 GiB+ Free: 1.315 GiB+ Trashed: 100.000 MiB+ Other: 8.241 GiBWhere the fields are:diff --git a/docs/content/docs.md b/docs/content/docs.mdindex 3483b7b3f..4d5a4dab6 100644--- a/docs/content/docs.md+++ b/docs/content/docs.md@@ -427,9 +427,9 @@ possibly signed sequence of decimal numbers, each with optionalfraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Validtime units are "ns", "us" (or "µs"), "ms", "s", "m", "h".-Options which use SIZE use KiByte (multiples of 1024 bytes) by default.-However, a suffix of `B` for Byte, `K` for KiByte, `M` for MiByte,-`G` for GiByte, `T` for TiByte and `P` for PiByte may be used. These are+Options which use SIZE use KiB (multiples of 1024 bytes) by default.+However, a suffix of `B` for Byte, `K` for KiB, `M` for MiB,+`G` for GiB, `T` for TiB and `P` for PiB may be used. These arethe binary units, e.g. 1, 2\*\*10, 2\*\*20, 2\*\*30 respectively.### --backup-dir=DIR ###@@ -473,9 +473,9 @@ This option controls the bandwidth limit. For example--bwlimit 10M-would mean limit the upload and download bandwidth to 10 MiByte/s.+would mean limit the upload and download bandwidth to 10 MiB/s.**NB** this is **bytes** per second not **bits** per second. To use a-single limit, specify the desired bandwidth in KiByte/s, or use a+single limit, specify the desired bandwidth in KiB/s, or use asuffix B|K|M|G|T|P. The default is `0` which means to not limit bandwidth.The upload and download bandwidth can be specified seperately, as@@ -483,13 +483,13 @@ The upload and download bandwidth can be specified seperately, as--bwlimit 10M:100k-would mean limit the upload bandwidth to 10 MiByte/s and the download-bandwidth to 100 KiByte/s. Either limit can be "off" meaning no limit, so+would mean limit the upload bandwidth to 10 MiB/s and the download+bandwidth to 100 KiB/s. Either limit can be "off" meaning no limit, soto just limit the upload bandwidth you would use--bwlimit 10M:off-this would limit the upload bandwidth to 10 MiByte/s but the download+this would limit the upload bandwidth to 10 MiB/s but the downloadbandwidth would be unlimited.When specified as above the bandwidth limits last for the duration of@@ -511,19 +511,19 @@ working hours could be:`--bwlimit "08:00,512k 12:00,10M 13:00,512k 18:00,30M 23:00,off"`-In this example, the transfer bandwidth will be set to 512 KiByte/s-at 8am every day. At noon, it will rise to 10 MiByte/s, and drop back-to 512 KiByte/sec at 1pm. At 6pm, the bandwidth limit will be set to-30 MiByte/s, and at 11pm it will be completely disabled (full speed).+In this example, the transfer bandwidth will be set to 512 KiB/s+at 8am every day. At noon, it will rise to 10 MiB/s, and drop back+to 512 KiB/sec at 1pm. At 6pm, the bandwidth limit will be set to+30 MiB/s, and at 11pm it will be completely disabled (full speed).Anything between 11pm and 8am will remain unlimited.An example of timetable with `WEEKDAY` could be:`--bwlimit "Mon-00:00,512 Fri-23:59,10M Sat-10:00,1M Sun-20:00,off"`-It means that, the transfer bandwidth will be set to 512 KiByte/s on-Monday. It will rise to 10 MiByte/s before the end of Friday. At 10:00-on Saturday it will be set to 1 MiByte/s. From 20:00 on Sunday it will+It means that, the transfer bandwidth will be set to 512 KiB/s on+Monday. It will rise to 10 MiB/s before the end of Friday. At 10:00+on Saturday it will be set to 1 MiB/s. From 20:00 on Sunday it willbe unlimited.Timeslots without `WEEKDAY` are extended to the whole week. So this@@ -542,7 +542,7 @@ being the non HTTP backends, `ftp`, `sftp` and `tardigrade`).Note that the units are **Byte/s**, not **bit/s**. Typicallyconnections are measured in bit/s - to convert divide by 8. Forexample, let's say you have a 10 Mbit/s connection and you wish rclone-to use half of it - 5 Mbit/s. This is 5/8 = 0.625 MiByte/s so you would+to use half of it - 5 Mbit/s. This is 5/8 = 0.625 MiB/s so you woulduse a `--bwlimit 0.625M` parameter for rclone.On Unix systems (Linux, macOS, …) the bandwidth limiter can be toggled by@@ -563,7 +563,7 @@ change the bwlimit dynamically:This option controls per file bandwidth limit. For the options see the`--bwlimit` flag.-For example use this to allow no transfers to be faster than 1 MiByte/s+For example use this to allow no transfers to be faster than 1 MiB/s--bwlimit-file 1Mdiff --git a/docs/content/drive.md b/docs/content/drive.mdindex 4b5c970c8..2c86761cb 100644--- a/docs/content/drive.md+++ b/docs/content/drive.md@@ -1225,7 +1225,7 @@ Use the -i flag to see what would be copied before copying.Drive has quite a lot of rate limiting. This causes rclone to belimited to transferring about 2 files per second only. Individual-files may be transferred much faster at 100s of MiByte/s but lots of+files may be transferred much faster at 100s of MiB/s but lots ofsmall files can take a long time.Server side copies are also subject to a separate rate limit. If youdiff --git a/docs/content/filtering.md b/docs/content/filtering.mdindex 59837954a..59f9b3d41 100644--- a/docs/content/filtering.md+++ b/docs/content/filtering.md@@ -586,17 +586,17 @@ remote or flag value. The fix then is to quote values containing spaces.### `--min-size` - Don't transfer any file smaller than thisControls the minimum size file within the scope of an rclone command.-Default units are `KiByte` but abbreviations `K`, `M`, `G`, `T` or `P` are valid.+Default units are `KiB` but abbreviations `K`, `M`, `G`, `T` or `P` are valid.-E.g. `rclone ls remote: --min-size 50k` lists files on `remote:` of 50 KiByte+E.g. `rclone ls remote: --min-size 50k` lists files on `remote:` of 50 KiBsize or larger.### `--max-size` - Don't transfer any file larger than thisControls the maximum size file within the scope of an rclone command.-Default units are `KiByte` but abbreviations `K`, `M`, `G`, `T` or `P` are valid.+Default units are `KiB` but abbreviations `K`, `M`, `G`, `T` or `P` are valid.-E.g. `rclone ls remote: --max-size 1G` lists files on `remote:` of 1 GiByte+E.g. `rclone ls remote: --max-size 1G` lists files on `remote:` of 1 GiBsize or smaller.### `--max-age` - Don't transfer any file older than this@@ -650,7 +650,7 @@ E.g. the scope of `rclone sync -i A: B:` can be restricted:rclone --min-size 50k --delete-excluded sync A: B:-All files on `B:` which are less than 50 KiByte are deleted+All files on `B:` which are less than 50 KiB are deletedbecause they are excluded from the rclone sync command.### `--dump filters` - dump the filters to the outputdiff --git a/docs/content/flags.md b/docs/content/flags.mdindex 70648eb08..9fd078e76 100644--- a/docs/content/flags.md+++ b/docs/content/flags.md@@ -18,8 +18,8 @@ These flags are available for every command.--backup-dir string Make backups into hierarchy based in DIR.--bind string Local address to bind to for outgoing connections, IPv4, IPv6 or name.--buffer-size SizeSuffix In memory buffer size when reading files for each --transfer. (default 16Mi)- --bwlimit BwTimetable Bandwidth limit in KiByte/s, or use suffix B|K|M|G|T|P or a full timetable.- --bwlimit-file BwTimetable Bandwidth limit per file in KiByte/s, or use suffix B|K|M|G|T|P or a full timetable.+ --bwlimit BwTimetable Bandwidth limit in KiB/s, or use suffix B|K|M|G|T|P or a full timetable.+ --bwlimit-file BwTimetable Bandwidth limit per file in KiB/s, or use suffix B|K|M|G|T|P or a full timetable.--ca-cert string CA certificate used to verify servers--cache-dir string Directory rclone will use for caching. (default "$HOME/.cache/rclone")--check-first Do all the checks before starting transfers.diff --git a/fs/accounting/stats.go b/fs/accounting/stats.goindex 8a5e67f37..fe1fdf11c 100644--- a/fs/accounting/stats.go+++ b/fs/accounting/stats.go@@ -390,9 +390,9 @@ func (s *StatsInfo) String() string {}}- _, _ = fmt.Fprintf(buf, "%s%11s / %s, %s, %s, ETA %s%s",+ _, _ = fmt.Fprintf(buf, "%s%13s / %s, %s, %s, ETA %s%s",dateString,- fs.SizeSuffix(s.bytes),+ fs.SizeSuffix(s.bytes).ByteUnit(),fs.SizeSuffix(ts.totalBytes).ByteUnit(),percent(s.bytes, ts.totalBytes),displaySpeedString,diff --git a/fs/accounting/token_bucket.go b/fs/accounting/token_bucket.goindex 01d9bc745..60c3df4d8 100644--- a/fs/accounting/token_bucket.go+++ b/fs/accounting/token_bucket.go@@ -59,7 +59,7 @@ const defaultMaxBurstSize = 4 * 1024 * 1024 // must be bigger than the biggest rfunc newEmptyTokenBucket(bandwidth fs.SizeSuffix) *rate.Limiter {// Relate maxBurstSize to bandwidth limit// 4M gives 2.5 Gb/s on Windows- // Use defaultMaxBurstSize up to 2GBit/s (256MByte/s) then scale+ // Use defaultMaxBurstSize up to 2GBit/s (256MiB/s) then scalemaxBurstSize := (bandwidth * defaultMaxBurstSize) / (256 * 1024 * 1024)if maxBurstSize < defaultMaxBurstSize {maxBurstSize = defaultMaxBurstSize@@ -104,7 +104,7 @@ func (tb *tokenBucket) StartTokenBucket(ctx context.Context) {tb.currLimit = ci.BwLimit.LimitAt(time.Now())if tb.currLimit.Bandwidth.IsSet() {tb.curr = newTokenBucket(tb.currLimit.Bandwidth)- fs.Infof(nil, "Starting bandwidth limiter at %vByte/s", &tb.currLimit.Bandwidth)+ fs.Infof(nil, "Starting bandwidth limiter at %v Byte/s", &tb.currLimit.Bandwidth)// Start the SIGUSR2 signal handler to toggle bandwidth.// This function does nothing in windows systems.diff --git a/fs/config/configflags/configflags.go b/fs/config/configflags/configflags.goindex 0b6fd8ee5..b7c656d9b 100644--- a/fs/config/configflags/configflags.go+++ b/fs/config/configflags/configflags.go@@ -97,8 +97,8 @@ func AddFlags(ci *fs.ConfigInfo, flagSet *pflag.FlagSet) {flags.IntVarP(flagSet, &ci.StatsFileNameLength, "stats-file-name-length", "", ci.StatsFileNameLength, "Max file name length in stats. 0 for no limit")flags.FVarP(flagSet, &ci.LogLevel, "log-level", "", "Log level DEBUG|INFO|NOTICE|ERROR")flags.FVarP(flagSet, &ci.StatsLogLevel, "stats-log-level", "", "Log level to show --stats output DEBUG|INFO|NOTICE|ERROR")- flags.FVarP(flagSet, &ci.BwLimit, "bwlimit", "", "Bandwidth limit in KiByte/s, or use suffix B|K|M|G|T|P or a full timetable.")- flags.FVarP(flagSet, &ci.BwLimitFile, "bwlimit-file", "", "Bandwidth limit per file in KiByte/s, or use suffix B|K|M|G|T|P or a full timetable.")+ flags.FVarP(flagSet, &ci.BwLimit, "bwlimit", "", "Bandwidth limit in KiB/s, or use suffix B|K|M|G|T|P or a full timetable.")+ flags.FVarP(flagSet, &ci.BwLimitFile, "bwlimit-file", "", "Bandwidth limit per file in KiB/s, or use suffix B|K|M|G|T|P or a full timetable.")flags.FVarP(flagSet, &ci.BufferSize, "buffer-size", "", "In memory buffer size when reading files for each --transfer.")flags.FVarP(flagSet, &ci.StreamingUploadCutoff, "streaming-upload-cutoff", "", "Cutoff for switching to chunked upload if file size is unknown. Upload starts after reaching cutoff or when file ends.")flags.FVarP(flagSet, &ci.Dump, "dump", "", "List of items to dump from: "+fs.DumpFlagsList)diff --git a/fs/sizesuffix.go b/fs/sizesuffix.goindex 72592d0c2..eda3c2368 100644--- a/fs/sizesuffix.go+++ b/fs/sizesuffix.go@@ -104,21 +104,11 @@ func (x SizeSuffix) BitRateUnit() string {// ByteUnit turns SizeSuffix into a string with byte unitfunc (x SizeSuffix) ByteUnit() string {- return x.unit("Byte")+ return x.unit("B")}// ByteRateUnit turns SizeSuffix into a string with byte rate unitfunc (x SizeSuffix) ByteRateUnit() string {- return x.unit("Byte/s")-}--// ByteShortUnit turns SizeSuffix into a string with byte unit short form-func (x SizeSuffix) ByteShortUnit() string {- return x.unit("B")-}--// ByteRateShortUnit turns SizeSuffix into a string with byte rate unit short form-func (x SizeSuffix) ByteRateShortUnit() string {return x.unit("B/s")}diff --git a/fs/sizesuffix_test.go b/fs/sizesuffix_test.goindex e215c74db..cb58b807c 100644--- a/fs/sizesuffix_test.go+++ b/fs/sizesuffix_test.go@@ -41,7 +41,7 @@ func TestSizeSuffixString(t *testing.T) {}}-func TestSizeSuffixByteShortUnit(t *testing.T) {+func TestSizeSuffixByteUnit(t *testing.T) {for _, test := range []struct {in float64want string@@ -58,30 +58,6 @@ func TestSizeSuffixByteShortUnit(t *testing.T) {{1 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024, "1 EiB"},{-1, "off"},{-100, "off"},- } {- ss := SizeSuffix(test.in)- got := ss.ByteShortUnit()- assert.Equal(t, test.want, got)- }-}--func TestSizeSuffixByteUnit(t *testing.T) {- for _, test := range []struct {- in float64- want string- }{- {0, "0 Byte"},- {102, "102 Byte"},- {1024, "1 KiByte"},- {1024 * 1024, "1 MiByte"},- {1024 * 1024 * 1024, "1 GiByte"},- {10 * 1024 * 1024 * 1024, "10 GiByte"},- {10.1 * 1024 * 1024 * 1024, "10.100 GiByte"},- {10 * 1024 * 1024 * 1024 * 1024, "10 TiByte"},- {10 * 1024 * 1024 * 1024 * 1024 * 1024, "10 PiByte"},- {1 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024, "1 EiByte"},- {-1, "off"},- {-100, "off"},} {ss := SizeSuffix(test.in)got := ss.ByteUnit()