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

azureblob: implement --use-server-modtime

Abdullah Saglam7be9855a706d
diff --git a/backend/azureblob/azureblob.go b/backend/azureblob/azureblob.go
index 80050a991..af6ff9ddd 100644
--- a/backend/azureblob/azureblob.go
+++ b/backend/azureblob/azureblob.go
@@ -1590,7 +1590,9 @@ func (o *Object) setMetadata(metadata map[string]string) {
for k, v := range metadata {
o.meta[strings.ToLower(k)] = v
}
- if modTime, ok := o.meta[modTimeKey]; ok {
+ // Set o.modTime from metadata if it exists and
+ // UseServerModTime isn't in use.
+ if modTime, ok := o.meta[modTimeKey]; !o.fs.ci.UseServerModTime && ok {
when, err := time.Parse(timeFormatIn, modTime)
if err != nil {
fs.Debugf(o, "Couldn't parse %v = %q: %v", modTimeKey, modTime, err)
diff --git a/docs/content/azureblob.md b/docs/content/azureblob.md
index 1087e2577..e1ea77086 100644
--- a/docs/content/azureblob.md
+++ b/docs/content/azureblob.md
@@ -80,7 +80,13 @@ docs](/docs/#fast-list) for more details.
The modified time is stored as metadata on the object with the `mtime`
key. It is stored using RFC3339 Format time with nanosecond
precision. The metadata is supplied during directory listings so
-there is no overhead to using it.
+there is no performance overhead to using it.
+
+If you wish to use the Azure standard `LastModified` time stored on
+the object as the modified time, then use the `--use-server-modtime`
+flag. Note that rclone can't set `LastModified`, so using the
+`--update` flag when syncing is recommended if using
+`--use-server-modtime`.
### Performance