forked from TrueCloudLab/rclone
@Sunil-P
box: Added support for interchangeable root folder for Box backend - #3422
This commit is contained in:
parent
4af5c9aed7
commit
39319b4858
2 changed files with 40 additions and 3 deletions
|
@ -54,7 +54,6 @@ const (
|
||||||
minSleep = 10 * time.Millisecond
|
minSleep = 10 * time.Millisecond
|
||||||
maxSleep = 2 * time.Second
|
maxSleep = 2 * time.Second
|
||||||
decayConstant = 2 // bigger for slower decay, exponential
|
decayConstant = 2 // bigger for slower decay, exponential
|
||||||
rootID = "0" // ID of root folder is always this
|
|
||||||
rootURL = "https://api.box.com/2.0"
|
rootURL = "https://api.box.com/2.0"
|
||||||
uploadURL = "https://upload.box.com/api/2.0"
|
uploadURL = "https://upload.box.com/api/2.0"
|
||||||
listChunks = 1000 // chunk size to read directory listings
|
listChunks = 1000 // chunk size to read directory listings
|
||||||
|
@ -106,6 +105,11 @@ func init() {
|
||||||
}, {
|
}, {
|
||||||
Name: config.ConfigClientSecret,
|
Name: config.ConfigClientSecret,
|
||||||
Help: "Box App Client Secret\nLeave blank normally.",
|
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",
|
Name: "box_config_file",
|
||||||
Help: "Box App config.json location\nLeave blank normally.",
|
Help: "Box App config.json location\nLeave blank normally.",
|
||||||
|
@ -241,6 +245,7 @@ type Options struct {
|
||||||
UploadCutoff fs.SizeSuffix `config:"upload_cutoff"`
|
UploadCutoff fs.SizeSuffix `config:"upload_cutoff"`
|
||||||
CommitRetries int `config:"commit_retries"`
|
CommitRetries int `config:"commit_retries"`
|
||||||
Enc encoder.MultiEncoder `config:"encoding"`
|
Enc encoder.MultiEncoder `config:"encoding"`
|
||||||
|
RootFolderID string `config:"root_folder_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fs represents a remote box
|
// 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)
|
f.dirCache = dircache.New(root, rootID, f)
|
||||||
|
|
||||||
// Find the current root
|
// Find the current root
|
||||||
|
|
|
@ -227,6 +227,28 @@ normally 8MB so increasing `--transfers` will increase memory use.
|
||||||
Depending on the enterprise settings for your user, the item will
|
Depending on the enterprise settings for your user, the item will
|
||||||
either be actually deleted from Box or moved to the trash.
|
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.
|
||||||
|
|
||||||
<!--- autogenerated options start - DO NOT EDIT, instead edit fs.RegInfo in backend/box/box.go then run make backenddocs -->
|
<!--- autogenerated options start - DO NOT EDIT, instead edit fs.RegInfo in backend/box/box.go then run make backenddocs -->
|
||||||
### Standard Options
|
### Standard Options
|
||||||
|
|
||||||
|
@ -280,6 +302,15 @@ Leave blank normally.
|
||||||
|
|
||||||
Here are the advanced options specific to box (Box).
|
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
|
#### --box-upload-cutoff
|
||||||
|
|
||||||
Cutoff for switching to multipart upload (>= 50MB).
|
Cutoff for switching to multipart upload (>= 50MB).
|
||||||
|
|
Loading…
Reference in a new issue