How to change timestamp of a folder/directory in Google Drive and OneDrive with rclone?

What is the problem you are having with rclone?

When using 'copy', timestamp of folder was not preserved. When using 'touch', new timestamp was not applied to the folder.

Run the command 'rclone version' and share the full output of the command.

rclone v1.66.0

  • os/version: Microsoft Windows 10 Pro 1909 (64 bit)
  • os/kernel: 10.0.18363.2274 (x86_64)
  • os/type: windows
  • os/arch: amd64
  • go/version: go1.22.1
  • go/linking: static
  • go/tags: cmount

Which cloud storage system are you using? (eg Google Drive)

Google Drive and OneDrive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

.\rclone.exe copy .\archive GoogleDrive:archive

.\rclone.exe touch GoogleDrive:archive --recursive --timestamp 2022-12-24T00:00:00

.\rclone.exe copy .\archive OneDrive:archive

.\rclone.exe touch OneDrive:archive --recursive --timestamp 2022-12-24T00:00:00

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

[GoogleDrive]
type = drive
client_id = XXX
client_secret = XXX
scope = drive
skip_gdocs = true
token = XXX
team_drive =

[OneDrive]
type = onedrive
token = XXX
drive_id = XXX
drive_type = personal

rclone touch operates on files only.

for rclone copy I am not sure why you think that directories mtime is not preserved.... I have just tested it - all works for both onedrive and gdrive.

Could you then provide some evidence of this not working?

Thank you, kapitainsky.

I did some additional tests, and I found that all subfolder timestamps were preserved except for those at the top directory level. In my case, the "archive" folder's mtime always reflects the upload time. I believe this is because the folder was originally created rather than copied. As a workaround, I now place the "archive" folder in a separate folder, say "upload", and then, after the upload, I move the "archive" folder to the root of the drive and delete the "upload" folder.

Is there a simpler solution? Also, for folders already on the server side, is there a way to use rclone to modify the mtime? Thank you!

rclone copies content of archive folder. Not folder itself... then you force new folder creation by using GoogleDrive:archive.

Probably what you want is:

rclone.exe copy . GoogleDrive: --include "/archive/**"

It works perfectly. Thanks, kapitainsky!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.