Where is duration format documentation or explanation? How to specify duration in days?

What is the problem you are having with rclone?

I can not find in the documentation how to specify days for the duration field. I get:

Fatal error: invalid argument "7d" for "--vfs-cache-max-age" flag: time: unknown unit "d" in duration "7d"

My main question is how to correctly format duration:
1) how to specify months (e.g. --vfs-cache-max-age 1m)
2) how to specify days (e.g. --vfs-cache-max-age 7d)
3) Can I omit minutes and second or I must to write: 1m0d0h0s?

What is your rclone version (output from rclone version)

rclone v1.55.1

  • os/type: linux
  • os/arch: amd64
  • go/version: go1.16.3
  • go/linking: static
  • go/tags: none

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Lubuntu 20.04

It's documented here:


Thank you. Finally, I found:

Options which use TIME use the go time parser. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".

There are actually two time parsers in use in rclone. One is the standard go one, and the other is an extended version called fs.Duration. I should probably move the --vfs-cache-max-age over to be an fs.Duration instead of a time.Duration and this would let you use --vfs-cache-max-age 7d

This would be an easy fix if someone wanted to have a go - change the definition from time.Duration to fs.Duration then add a few casts back to time.Duration - the compiler will tell you exactly where they are needed.

1 Like

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