diff --git a/backend/dropbox/dropbox.go b/backend/dropbox/dropbox.go index bd4f28c05..28eaa30be 100644 --- a/backend/dropbox/dropbox.go +++ b/backend/dropbox/dropbox.go @@ -216,7 +216,10 @@ are supported. Note that we don't unmount the shared folder afterwards so the --dropbox-shared-folders can be omitted after the first use of a particular -shared folder.`, +shared folder. + +See also --dropbox-root-namespace for an alternative way to work with shared +folders.`, Default: false, Advanced: true, }, { @@ -237,6 +240,11 @@ shared folder.`, encoder.EncodeDel | encoder.EncodeRightSpace | encoder.EncodeInvalidUtf8, + }, { + Name: "root_namespace", + Help: "Specify a different Dropbox namespace ID to use as the root for all paths.", + Default: "", + Advanced: true, }}...), defaultBatcherOptions.FsOptions("For full info see [the main docs](https://rclone.org/dropbox/#batch-mode)\n\n")...), }) } @@ -253,6 +261,7 @@ type Options struct { AsyncBatch bool `config:"async_batch"` PacerMinSleep fs.Duration `config:"pacer_min_sleep"` Enc encoder.MultiEncoder `config:"encoding"` + RootNsid string `config:"root_namespace"` } // Fs represents a remote dropbox server @@ -502,8 +511,11 @@ func NewFs(ctx context.Context, name, root string, m configmap.Mapper) (fs.Fs, e f.features.Fill(ctx, f) - // If root starts with / then use the actual root - if strings.HasPrefix(root, "/") { + if f.opt.RootNsid != "" { + f.ns = f.opt.RootNsid + fs.Debugf(f, "Overriding root namespace to %q", f.ns) + } else if strings.HasPrefix(root, "/") { + // If root starts with / then use the actual root var acc *users.FullAccount err = f.pacer.Call(func() (bool, error) { acc, err = f.users.GetCurrentAccount()