diff --git a/backend/box/box.go b/backend/box/box.go index 6d687361c..e6691ac4f 100644 --- a/backend/box/box.go +++ b/backend/box/box.go @@ -53,8 +53,7 @@ const ( rcloneEncryptedClientSecret = "sYbJYm99WB8jzeaLPU0OPDMJKIkZvD2qOn3SyEMfiJr03RdtDt3xcZEIudRhbIDL" minSleep = 10 * time.Millisecond maxSleep = 2 * time.Second - decayConstant = 2 // bigger for slower decay, exponential - rootID = "0" // ID of root folder is always this + decayConstant = 2 // bigger for slower decay, exponential rootURL = "https://api.box.com/2.0" uploadURL = "https://upload.box.com/api/2.0" listChunks = 1000 // chunk size to read directory listings @@ -106,6 +105,11 @@ func init() { }, { Name: config.ConfigClientSecret, Help: "Box App Client Secret\nLeave blank normally.", + }, { + Name: "root_folder_id", + Help: "Fill in for rclone to use a non root folder as its starting point.", + Default: "0", + Advanced: true, }, { Name: "box_config_file", Help: "Box App config.json location\nLeave blank normally.", @@ -241,6 +245,7 @@ type Options struct { UploadCutoff fs.SizeSuffix `config:"upload_cutoff"` CommitRetries int `config:"commit_retries"` Enc encoder.MultiEncoder `config:"encoding"` + RootFolderID string `config:"root_folder_id"` } // Fs represents a remote box @@ -417,7 +422,8 @@ func NewFs(name, root string, m configmap.Mapper) (fs.Fs, error) { }) } - // Get rootID + // Get rootFolderID + rootID := f.opt.RootFolderID f.dirCache = dircache.New(root, rootID, f) // Find the current root diff --git a/docs/content/box.md b/docs/content/box.md index dcdcf0968..855520466 100644 --- a/docs/content/box.md +++ b/docs/content/box.md @@ -227,6 +227,28 @@ normally 8MB so increasing `--transfers` will increase memory use. Depending on the enterprise settings for your user, the item will either be actually deleted from Box or moved to the trash. +### Root folder ID ### + +You can set the `root_folder_id` for rclone. This is the directory +(identified by its `Folder ID`) that rclone considers to be the root +of your Box drive. + +Normally you will leave this blank and rclone will determine the +correct root to use itself. + +However you can set this to restrict rclone to a specific folder +hierarchy. + +In order to do this you will have to find the `Folder ID` of the +directory you wish rclone to display. This will be the last segment +of the URL when you open the relevant folder in the Box web +interface. + +So if the folder you want rclone to use has a URL which looks like +`https://app.box.com/folder/11xxxxxxxxx8` +in the browser, then you use `11xxxxxxxxx8` as +the `root_folder_id` in the config. + ### Standard Options @@ -280,6 +302,15 @@ Leave blank normally. Here are the advanced options specific to box (Box). +#### --box-root-folder-id + +Fill in for rclone to use a non root folder as its starting point. + +- Config: root_folder_id +- Env Var: RCLONE_BOX_ROOT_FOLDER_ID +- Type: string +- Default: "0" + #### --box-upload-cutoff Cutoff for switching to multipart upload (>= 50MB).