Preserve Directory modification time on Windows?

Hi all. I love rclone, and use it a lot, but I've run into something bothersome.

What is the problem you are having with rclone?

When I try to copy or sync files with rclone from one drive to another, the directories' modified times are set to when the copy/sync happens, rather than the modified time of the source directories.

What is your rclone version (output from rclone version)

rclone v1.53.1
- os/arch: windows/amd64
- go version: go1.15

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Windows 10 Pro, 64-bit, Version 2004 (OS Build 19041.450)

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

rclone sync "C:/dir" "D:/dir"

Though, I also tested with:

rclone copy "C:/dir" "D:/dir"

This has been posted about before here (I can't include links in my post, so here is the thread request path: /t/is-there-a-way-to-make-sure-rclone-preserves-the-metadata-of-the-date-created-or-date-modified-fields/17421), so I will omit logs/my personal rclone.conf. Ultimately, the solution seems to be to use robocopy, but I'm kind of focused on rclone's sync option. I realize robocopy has /mir, which I will fall back to in the case that rclone can't work with this, but I just wanted to ask if this was easily possible to fix, or if there already exists some flag to enable the behavior.

Thanks very much, and thanks for making rclone, I really appreciate this tool. <3

hello and welcome to the forum,

rclone is not really designed for local to local.
and on windows, the mod-time for directories is just one of many concerns.

is there something unique about rclone sync that you cannot find with another tool?

as for robocopy, keep in mind that it cannot verify the files it copies, perhaps a fatal flaw.
imho, the only reason to use robocopy, its only unique feature is /EFSRAW

Hi, thanks!

I'm aware of that, but this flaw would persist regardless of the source if the dest is in Windows -- so while my use-case is not a priority, the issue would affect even use-cases rclone is designed for. What other concerns are there?

Honestly, it's just incredibly straight-forward and easy to use, and I've never had any issues with files it creates. It's also very easy to set up automated tasks with in both batch and bash scripts, and it's cross-platform, so I can port commands around as necessary.

Fair enough; I was only looking into it for the thread I mentioned above's resolution on it. Do you have another tool you'd suggest that can perform a sync (with deletion), preserve date/time stamps and security info on Windows, and can verify files?

yes, rclone is great open-source software.

  • fastcopy
  • freefilesync
  • secondcopy, 15 years and never failed me once.
  • for backup, not simple sync, veeam
1 Like

Indeed. I'm new to golang, or I'd throw up a pull request. I actually do intend to donate soon.

Thanks for the suggestions, I'll look into those!

if you use rclone for local to local on windows, you might find my wiki useful.

That was actually linked on the helpful thread I had linked above. I don't use currently use rclone for backups, though (and based on your above posts, I shouldn't?)

it all depends on your use-case.

there is backup of files to cloud.

there is backup of a windows system, for bare-metal recovery.
i use veeam for that and rclone to copy veeam backup files to cloud using a command like.

in both cases i use a rclone command like this, simplified as
rclone sync C:\data\keepass wasabi:kdbx/backup --backup-dir=wasabi:kdbx/archive/20200915.185625

Ah got, it thanks for the info. I assume those are KeePass databases? I also use KeePass, haha.

You mentioned earlier that rclone was not ideal for local to local, due to many concerns. Considering that you were now promoting it in your previous post, what are those many concerns? From my use, even that timestamp issue were fixed, I don't know of any -- and I especially can't think of any that would only exist in local to local, considering most issues that would arise should also arise in any source -> local.

i have a python script,
as an example, for keepass.
the scipt will

  • fastcopy - copy the files to local backup server
  • 7zip - create a zip and copy to local backup server
  • rclone - copy local files to cloud
  • rclone - copy zip file to cloud

Okay, are you saying that that is what you use to avoid copying local to local?

What about using rclone for local to local is not ideal, due to "many concerns" -- and are any of those things not also true of copying from any source -> local where local is Windows?

if you want to use rclone for local to local and it does all that you need, then you should use it.

it is nice that rclone is multi-platform and i use it on windows, linux, wsl2, raspberry pi, android cellphone and more but only if the source and/or dest is cloud.
you mentioned keepass, i run keepass on my android phone and desktop, so i use rclone on both to keep the database up to date.

for local to local:
i need a tool designed for windows desktops and more importantly window servers.
one concern, as you noticed the lack of a /mir flag, and that robocopy has dozens of windows specific flags.

Sure, but what are the actual reasons that rclone isn't good for local to local that don't affect rclone cloud -> local?

What do you mean "designed for windows desktops and servers" -- you can use this perfectly fine on both? Well, sync does what /mir does, no? And why do robocopy's windows-styled flags matter if the only good reason to use it is for /EFSRAW ?

as i mentioned, if rclone works for you, then great, use it.

i maintain a set of windows server for the company i worked for.
we have to comply with HIPAA and other regulations.
many files on some of those windows server, are encrypted with a key, that i do not have access to and the contents i will never be able to view.
at times, i need to copy such files between servers so /efsraw is a must.
and then do a checksum after the copy

I'll just note that rclone doesn't preserve directory modification times on any platform or with any backend.

Rclone is all about the files, not the directories.

It wouldn't be impossible to add though.

Ah, fair enough. And I appreciate your reply! I have yet to find a tool I like that I find as robust as rclone that can also deftly deal with cloud storage. I would love it if that made it on the tracker. Should I submit a GitHub issue or something? I'd also be happy to throw you a donation either way, I love this software -- and I know how demanding developing a popular open-source program can be.

Make an issue for it and I'll see what we can do!

Donations always much appreciated :smiley:

1 Like

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