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

drive, acd, onedrive: Cache the directory IDs when reading the parent directory

Nick Craig-Wood3fe94482298e
diff --git a/amazonclouddrive/amazonclouddrive.go b/amazonclouddrive/amazonclouddrive.go
index 9512903ec..89e88af7f 100644
--- a/amazonclouddrive/amazonclouddrive.go
+++ b/amazonclouddrive/amazonclouddrive.go
@@ -405,6 +405,8 @@ func (f *Fs) ListDir(out fs.ListOpts, job dircache.ListDirJob) (jobs []dircache.
switch *node.Kind {
case folderKind:
if out.IncludeDirectory(remote) {
+ // cache the directory ID for later lookups
+ f.dirCache.Put(remote, *node.Id)
dir := &fs.Dir{
Name: remote,
Bytes: -1,
diff --git a/drive/drive.go b/drive/drive.go
index bb628e9cb..765f38c0d 100644
--- a/drive/drive.go
+++ b/drive/drive.go
@@ -564,6 +564,8 @@ func (f *Fs) ListDir(out fs.ListOpts, job dircache.ListDirJob) (jobs []dircache.
// ignore object or directory
case item.MimeType == driveFolderType:
if out.IncludeDirectory(remote) {
+ // cache the directory ID for later lookups
+ f.dirCache.Put(remote, item.Id)
dir := &fs.Dir{
Name: remote,
Bytes: -1,
diff --git a/onedrive/onedrive.go b/onedrive/onedrive.go
index c89b322fe..208f9804e 100644
--- a/onedrive/onedrive.go
+++ b/onedrive/onedrive.go
@@ -406,6 +406,8 @@ func (f *Fs) ListDir(out fs.ListOpts, job dircache.ListDirJob) (jobs []dircache.
remote := job.Path + info.Name
if info.Folder != nil {
if out.IncludeDirectory(remote) {
+ // cache the directory ID for later lookups
+ f.dirCache.Put(remote, info.ID)
dir := &fs.Dir{
Name: remote,
Bytes: -1,