What is the problem you are having with rclone?
The output of the rclone size
command is non-standard. Did it change between versions? Or is it an OS difference?
One machine outputs results in the following format:
Total objects: 86213
Total size: 259.607 GBytes (278751338420 Bytes)
The other outputs in this format:
Total objects: 86213
Total size: 259.607 GiByte (278751338420 bytes)
What is your rclone version (output from rclone version
)
rclone v1.51.0
- os/arch: windows/amd64
- go version: go1.13.7
rclone v1.57.0-beta.5642.6a9ef27b0
- os/version: slackware 14.2+ (64 bit)
- os/kernel: 4.19.107-Unraid (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.17
- go/linking: static
- go/tags: none
Which cloud storage system are you using? (eg Google Drive)
Google Drive
The command you were trying to run (eg rclone copy /tmp remote:tmp
)
rclone size remote: --fast-list
The rclone config contents with secrets removed.
[remote]
type = drive
client_id =
client_secret =
scope = drive
token =
root_folder_id =
A log from the command with the -vv
flag
Paste log here
asdffdsa
(jojothehumanmonkey)
November 16, 2021, 10:20pm
2
as i understand it, rclone always used GiByte
internally.
in the past, the text was GBytes
.
now, the text is GiByte
https://rclone.org/docs/#human-readable
note: v1.57.0
is has been released, no need for the beta.
perhaps @albertony has a comment?
1 Like
The only reason I mention it is because I was (badly) parsing the output and it took me ages to work out that things were breaking because of the changing capitalisation of "Bytes" and the dropping of the "s" and addition of binary prefix in the human-readable version.
I couldn't find any documentation about whether this was an intentional change or not.
It's an intended change in 1.57.
Pull request details are here:
rclone:master
โ albertony:human_readable
opened 08:25PM - 12 Apr 21 UTC
*UPDATE 24 Aug 2021, from discussions (see below):*
- *Refactored into a bit moโฆ re conservative approach, documented in [this comment](https://github.com/rclone/rclone/pull/5237#issuecomment-834413850).*
- *Short flag `-H` removed, postponed since it was raised concern that means transfer hardlinks in rsync*
- *Unit format changed from `MiByte` to `MiB` (which is more of an continuation of [#5087](https://github.com/rclone/rclone/pull/5087))*
#### What is the purpose of this change?
Introduce global flag `--human-readable`/`-H` to switch output between raw values and values with suffix.
NOTE:
- Was depending on PR https://github.com/rclone/rclone/pull/5087 (this PR was split out from that), it has now been merged and this PR rebased accordingly.
DONE:
- Added option `--human-readable`/`-H` for `ls` and friends.
- Prints sizes with suffix, e.g. `9.762Ki`, instead of raw byte count, `9996`.
- Syntax for linux commands rsync, ls, df, dh etc all have `-h, --human-readable`, so I also chose `--human-readable`. The short form `-h` is already taken by `--help` in rclone, so picked `-H`. `df` command takes `-h` for `--human-readable` and `-H` as short form for `--si` (mean human-readable with decimal prefix), so this will be inconsistent with rclone, but other commands have no shortform for `--si` and `--human-readable` is so long to type so it is best to have some short form - so ended up with `-H`..
- Uses decimal suffix for human-readable counts in `lsd` (1k means 1000 files), same as `ncdu`.
- Fixes issue #1890
- Also consider option `--human-readable` for `ncdu` command.
- Previously always human-readable format.
- Now supports raw format, switching between them interactively with key `u`.
- Note: To consider global flag `--human-readable` the default had to be changed, so it will now default to raw numbers, and must either explicitely start it with option `--human-readable` or use enter key `u` after startup to get back old to what was default before.
- TODO: Stick with human readable format as the default as before? And just accept that ncdu does not consider `--human-readable` flag, but keep interactive key `u` as the (only) way of switching?
- Also consider option `--human-readable` for `size` command.
- Previously would output string with both raw number and human-readable, now either or.
- Uses decimal suffix for human-readable counts, same as `lsd` and `ncdu`.
- Also consider option `--human-readable` for `about` command.
- Previously did this by default, and had option `--full` to output raw numbers.
- Now the opposite: Raw numbers by default, unless `--human-readable`.
- Note: The `--full` option was removed!
- Also fixed that count `Objects: Total number of objects in the storage.` uses decimal suffix, used binary suffix before.
- Also consider option `--human-readable` for `tree` command.
- It did already have a custom option `--human`. Removed this in favor of the global `--human-readable`/`-H` option for consistency.
- Copy, sync, stats etc always use human-readable sizes, like before, without considering the option!
TODO:
- Uses the `Mi` format in tabular output, where space is limited,such as results from `ls` with `--human-readable`, but what about more "non-tabular" output, from `size`, `about` etc?
- Show human-readable counts with suffix (not just sizes)?
- When using single-letter suffix for size and count it looks consistent:
```
Total objects: 2.171k
Total bytes: 176.584Mi
```
But what if deciding (previous decision) to use longer suffix for size, should we still use the single-letter suffix for count, as there is no unit `kObject`, or does that look inconsistent?
```
Total objects: 2.171k
Total bytes: 176.584 MiByte
```
See this and more examples below.
##### Breaking changes
- The `about` command:
- Option `--full` no longer exist.
- Opposite default: Raw numbers by default, must now use global option `--human-readable`/`-H` to get output similar to previous default.
- The `tree` command:
- Option `--human` no longer exist, replaced by global option `--human-readable`/`-H`.
- The `ncdu` command:
- Opposite default: Raw numbers by default, must now use global option `--human-readable`/`-H` or interactive key `u` to get output similar to previous default.
##### Examples
- `ls` with `--human-readable` (new option)
```
336.125Ki langs.model.xml
34.827Ki license.txt
3.439Mi notepad++.exe
955 shortcuts.xml
```
- `size`:
- Before:
```
Total objects: 2171
Total size: 176.584 MBytes (185161745 Bytes)
```
- Now
- Default:
```
Total objects: 2171
Total bytes: 185161745
```
- With `--human-readable`
```
Total objects: 2.171k
Total bytes: 176.584Mi
```
- Possible alternatives
- Longer suffix with `--human-readable`:
```
Total objects: 2.171k
Total bytes: 176.584 MiB
```
- Even longer suffix with `--human-readable` for size:
```
Total objects: 2.171k
Total bytes: 176.584 MiByte
```
- Longer suffix with `--human-readable` but not considered for counts:
```
Total objects: 2171
Total bytes: 176.584 MiB
```
- Even longer suffix with `--human-readable` for size:
```
Total objects: 2171
Total bytes: 176.584 MiByte
```
- `about`:
- Before
- Default:
```
Total: 952.131G
Used: 438.671G
Free: 513.460G
```
- With `--full`:
```
Total: 1022342836224
Used: 471019343872
Free: 551323492352
```
- Now
- Default:
```
Total: 1022342836224
Used: 471019180032
Free: 551323656192
```
- With `--human-readable`:
```
Total: 952.131Gi
Used: 438.671Gi
Free: 513.460Gi
```
- Possible alternatives:
- Longer suffix with `--human-readable`:
```
Total: 952.131 GiB
Used: 438.671 GiB
Free: 513.460 GiB
```
- Even longer suffix With `--human-readable`:
```
Total: 952.131 GiByte
Used: 438.671 GiByte
Free: 513.460 GiByte
```
#### Was the change discussed in an issue or in the forum before?
Fixes https://github.com/rclone/rclone/issues/1890
Highly dependendent on https://github.com/rclone/rclone/pull/5087
#### Checklist
- [X] I have read the [contribution guidelines](https://github.com/rclone/rclone/blob/master/CONTRIBUTING.md#submitting-a-pull-request).
- [X] I have added tests for all changes in this PR if appropriate.
- [X] I have added documentation for the changes if appropriate.
- [X] All commit messages are in [house style](https://github.com/rclone/rclone/blob/master/CONTRIBUTING.md#commit-messages).
- [ ] I'm done, this Pull Request is ready for review :-)
1 Like
Thanks. I couldn't find that pull request searching for that as both versions seemed to have the human readable option.
What's the reasoning behind dropping the plural "s"?
I wouldn't want to assume anything so @albertony could comment.
One a different note, you might want to check out json output and parse that as it's a bit cleaner than text based parsing.
rclone size DB: --fast-list --json
{"count":5356,"bytes":22417249486264}
and you can parse using anything you want, but here's a jq example
felix@gemini:~$ rclone size DB: --fast-list --json | jq
{
"count": 5358,
"bytes": 22422646464479
}
rclone size DB: --fast-list --json | jq '.bytes'
22468674386219
1 Like
It was a bash script and using old and dirty code so text seemed easier than parsing json
In general, rclone has always shown values in binary units (powers of 2, or rather 1024) when referring to sizes, and decimal units (powers of 10) for counts.
Version 1.55 and older used the SI standard notation, which traditionally has been used for binary units as well, even if strictly speaking indicating decimal units. Rclone used some different forms, such as: M
, MB
, MBytes
.
Version 1.56 changed to use of IEC standard notation for sizes, to avoid any confusion. And, if I remember correctly, there was also some adjustments to make the form more consistent accross rclone, Mi
vs MiB
vs MiByte
: It was then chosen to use the long form MiByte
as primary, with short form Mi
as secondary, with support for just M
in config input for backwards-compatibility. This is Use binary/IEC prefix for base-2 and decimal/SI prefix for base-10 numbers by albertony ยท Pull Request #5087 ยท rclone/rclone ยท GitHub .
Version 1.57 included an adjustment of the primary form from MiByte
to the more used MiB
form. This was done as part of the introduction of --human-readable flag to switch output between raw values and values with suffix. This is Introduce global flag --human-readable by albertony ยท Pull Request #5237 ยท rclone/rclone ยท GitHub .
1 Like
Thanks for the explanation, but what was the reason for dropping the plural? Perhaps for consistency when only 1 GiB for example? Or is that the standard IEC notation (I couldn't find anything about the plural)?
I think in many cases it can be considered more like a mathematical unit symbol, and then should be plain singular form. Like with centimeters: "75 cm", not "75 cms". Its not always clear cut though, e.g. when part of more natural sentences it may make sense to use plural. The mentioned PRs tried to make it more correct and consistent across rclone, but as can be seen from the descriptions I did not find it to be all clear cut decisions...
1 Like
Now it seems to have changed again!
Instead of:
Total objects: 86213
Total size: 259.607 GiByte (278751338420 bytes)
the B is now capitalised again and "yte" has been dropped.
Total objects: 86213
Total size: 259.607 GiB (278751338420 Bytes)
Is this going to change any more?
Without knowing what versions you are comparing against, it's answer.
ncw
(Nick Craig-Wood)
November 18, 2021, 3:44pm
13
Quite possibly... I recommend parsing the JSON output which won't change, rather than the human readable output which gets tweaked to improve the user experience continuously.
$ rclone size --json ~/go/src/github.com/rclone/rclone
{"count":4414,"bytes":961001099}
1 Like
This was mentioned in the accepted solution:
1 Like
system
(system)
Closed
November 21, 2021, 3:47pm
15
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.