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

Add Drive specific option: --drive-skip-gdocs - fixes #1035

okareszcbc113492a7d
diff --git a/docs/content/drive.md b/docs/content/drive.md
index c0728f52d..0032982f0 100644
--- a/docs/content/drive.md
+++ b/docs/content/drive.md
@@ -203,6 +203,10 @@ Here are the possible extensions with their corresponding mime types.
| xlsx | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet | Microsoft Office Spreadsheet |
| zip | application/zip | A ZIP file of HTML, Images CSS |
+#### --drive-skip-gdocs ####
+
+Skip google documents in all listings. If given, gdocs practically become invisible to rclone.
+
### Limitations ###
Drive has quite a lot of rate limiting. This causes rclone to be
diff --git a/drive/drive.go b/drive/drive.go
index d2a6f100b..48d8fa437 100644
--- a/drive/drive.go
+++ b/drive/drive.go
@@ -44,6 +44,7 @@ var (
driveFullList = fs.BoolP("drive-full-list", "", false, "Use a full listing for directory list. More data but usually quicker. (obsolete)")
driveAuthOwnerOnly = fs.BoolP("drive-auth-owner-only", "", false, "Only consider files owned by the authenticated user. Requires drive-full-list.")
driveUseTrash = fs.BoolP("drive-use-trash", "", false, "Send files to the trash instead of deleting permanently.")
+ driveSkipGdocs = fs.BoolP("drive-skip-gdocs", "", false, "Skip google documents in all listings.")
driveExtensions = fs.StringP("drive-formats", "", defaultExtensions, "Comma separated list of preferred formats for downloading Google docs.")
// chunkSize is the size of the chunks created during a resumable upload and should be a power of two.
// 1<<18 is the minimum size supported by the Google uploader, and there is no maximum.
@@ -494,12 +495,16 @@ func (f *Fs) ListDir(out fs.ListOpts, job dircache.ListDirJob) (jobs []dircache.
out.SetError(err)
return true
}
- obj := o.(*Object)
- obj.isDocument = true
- obj.url = link
- obj.bytes = -1
- if out.Add(o) {
- return true
+ if !*driveSkipGdocs {
+ obj := o.(*Object)
+ obj.isDocument = true
+ obj.url = link
+ obj.bytes = -1
+ if out.Add(o) {
+ return true
+ }
+ } else {
+ fs.Debug(f, "Skip google document: %q", remote)
}
}
default: