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

s3: make SetModTime work for GLACIER while syncing - Fixes #3224

Philip Harvey1a2fb522667e
diff --git a/backend/s3/s3.go b/backend/s3/s3.go
index 1d9c4ca32..65525ec13 100644
--- a/backend/s3/s3.go
+++ b/backend/s3/s3.go
@@ -1736,6 +1736,9 @@ func (o *Object) SetModTime(modTime time.Time) error {
if o.fs.opt.SSEKMSKeyID != "" {
req.SSEKMSKeyId = &o.fs.opt.SSEKMSKeyID
}
+ if o.fs.opt.StorageClass == "GLACIER" || o.fs.opt.StorageClass == "DEEP_ARCHIVE" {
+ return fs.ErrorCantSetModTime
+ }
if o.fs.opt.StorageClass != "" {
req.StorageClass = &o.fs.opt.StorageClass
}
diff --git a/docs/content/s3.md b/docs/content/s3.md
index 80f96e0f3..da8b8a80b 100644
--- a/docs/content/s3.md
+++ b/docs/content/s3.md
@@ -268,6 +268,11 @@ files whose local modtime is newer than the time it was last uploaded.
The modified time is stored as metadata on the object as
`X-Amz-Meta-Mtime` as floating point since the epoch accurate to 1 ns.
+If the modification time needs to be updated rclone will attempt to perform a server
+side copy to update the modification if the object can be copied in a single part.
+In the case the object is larger than 5Gb or is in Glacier or Glacier Deep Archive
+storage the object will be uploaded rather than copied.
+
### Multipart uploads ###
rclone supports multipart uploads with S3 which means that it can