Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

onedrive: add list_chunk option

Nick Gaya1fd9b483c887
diff --git a/backend/onedrive/onedrive.go b/backend/onedrive/onedrive.go
index 17e505a60..371de6534 100755
--- a/backend/onedrive/onedrive.go
+++ b/backend/onedrive/onedrive.go
@@ -361,6 +361,11 @@ This will only work if you are copying between two OneDrive *Personal* drives AN
the files to copy are already shared between them. In other cases, rclone will
fall back to normal copy (which will be slightly slower).`,
Advanced: true,
+ }, {
+ Name: "list_chunk",
+ Help: "Size of listing chunk.",
+ Default: 1000,
+ Advanced: true,
}, {
Name: "no_versions",
Default: false,
@@ -468,6 +473,7 @@ type Options struct {
DriveType string `config:"drive_type"`
ExposeOneNoteFiles bool `config:"expose_onenote_files"`
ServerSideAcrossConfigs bool `config:"server_side_across_configs"`
+ ListChunk int64 `config:"list_chunk"`
NoVersions bool `config:"no_versions"`
LinkScope string `config:"link_scope"`
LinkType string `config:"link_type"`
@@ -896,7 +902,7 @@ type listAllFn func(*api.Item) bool
func (f *Fs) listAll(ctx context.Context, dirID string, directoriesOnly bool, filesOnly bool, fn listAllFn) (found bool, err error) {
// Top parameter asks for bigger pages of data
// https://dev.onedrive.com/odata/optional-query-parameters.htm
- opts := f.newOptsCall(dirID, "GET", "/children?$top=1000")
+ opts := f.newOptsCall(dirID, "GET", fmt.Sprintf("/children?$top=%d", f.opt.ListChunk))
OUTER:
for {
var result api.ListChildrenResponse
diff --git a/docs/content/flags.md b/docs/content/flags.md
index 58cfd3b61..48d37d4ea 100755
--- a/docs/content/flags.md
+++ b/docs/content/flags.md
@@ -415,6 +415,7 @@ and may be set in the config file.
--onedrive-link-password string Set the password for links created by the link command.
--onedrive-link-scope string Set the scope of the links created by the link command. (default "anonymous")
--onedrive-link-type string Set the type of the links created by the link command. (default "view")
+ --onedrive-list-chunk int Size of listing chunk. (default 1000)
--onedrive-no-versions Remove all versions on modifying operations
--onedrive-region string Choose national cloud region for OneDrive. (default "global")
--onedrive-server-side-across-configs Allow server-side operations (e.g. copy) to work across different onedrive configs.
diff --git a/docs/content/onedrive.md b/docs/content/onedrive.md
index e3cdbf336..60e31ea4d 100644
--- a/docs/content/onedrive.md
+++ b/docs/content/onedrive.md
@@ -325,6 +325,15 @@ fall back to normal copy (which will be slightly slower).
- Type: bool
- Default: false
+#### --onedrive-list-chunk
+
+Size of listing chunk.
+
+- Config: list_chunk
+- Env Var: RCLONE_ONEDRIVE_LIST_CHUNK
+- Type: int
+- Default: 1000
+
#### --onedrive-no-versions
Remove all versions on modifying operations