Mega does not preserve timestamp

Using v1.52.0/testbuilds/ on Ubuntu 18.04

Mega does not preserve timestamps when using rclone copy, sync, or mount (also tried mount in combination with rsync). Is this normal?

Any file that I upload to it has today's timestamp, so now I can't sync from my old cloud storage to mega without making my local copy worthless.

thanks

Right as it's documented here:

Oh man. I spent so much time searching.. and of course on uploading all my files before noticing it.. how did I not see this? Thanks a lot. :slight_smile:

Is it a mega-specific thing, or has it just not been implemented in rclone? I would like to help, but probably can't.

I tried to use megacmd in combination with an rclone mount of my old cloud drive, but that doesn't really work. Perhaps because it only uses a single connection, which is way too slow.

As far as we know mega doesn't have a way of setting the timestamp on a file or providing it when you upload a file.

The mega interface was reverse engineered from their C++ SDK so it might be that we missed how to do this.

I see. megacmd does set the correct time when using "put" to upload a file and the c++ SDK github page reads " MEGAcmd, a higher level command line application that uses the SDK to provide interactive and scriptable access to MEGA, can be found here."

so maybe the code of megacmd contains some clues?

Then again I don't know anything and you probably know it very well and also about megacmd, in which case I am sorry for my rambling.I looked at the code and have no idea what I'm looking at :frowning:

That is useful info, thanks. For the avoidance of doubt, it sets the modification time on the file rather than the current time?

It probably does. However I used to do lots of c++ programming and I have exactly the same feeling about the megasdk code!

Knowing that it is possible is very useful though.

Any chance you could upload a very small text file with put and capture the debug output from megacmd - that might give a hint as to what needs to be done.

Thanks

Okay I tested it thoroughly:

Mega differentiates between the "Date added" and "Last modified". With megacmd this works flawlessly. A file modified at 14:54 that was uploaded at 15:00 has "Date added" 15:00 and "Last modified" 14:54. Syncing it through the mega Windows client requires no resync, as mega recognizes it's the same file. See image: i.imgur dot com/InFRJRf.png

Now with rclone, on the other hand, the uploaded file has no "Last modified" time, only a "Date added". Mega then assumes that the "Date added" is the "Last modified" time. So when you download a file from mega that was uploaded through rclone, its modification time reads as the time of upload. When you copy that file within mega, its "Date added" is updated, so when you download the new copy, you have two files with different modification times. See image (compare to other): i.imgur dot com/CSVa6Br.png


There does not seem to be anything useful in the log

my@email.com:/$ put -vvv megacmd-xUbuntu_20.04_amd64.deb
[API:debug: 14:24:17] Starting upload: megacmd-xUbuntu_20.04_amd64.deb to : Cloud Drive
Upload finished: /megacmd-xUbuntu_20.04_amd64.deb
[verbose: 14:24:17] Inform State Listener: Output to write in socket 73: <progress:-2:7960894>
TRANSFERRING ||#######################################################################################################################################################################################################||(7/7 MB: 100.00 %)
[API:verbose: 14:24:17] Procesed put --clientID=1 --client-width=235 -vvv megacmd-xUbuntu_20.04_amd64.deb in thread: 139695447058176 socket output: 89
[verbose: 14:24:17] Output to write in socket 89

That is really useful - thank you.

If you use mega-cmd the interactive version, you can set debug which I think shows the actual HTTP transactions. My account seems to be broken at the moment otherwise I'd try it myself!

The obvious place for this to go would be in the attr sent at the end of the upload. At the moment we only send n for name - I wonder if there are more things which could go in there....

Gotta dash - family calling

Ehm is interactive mode not the one where i am in a separate, mega-cmd command line? (i type in mega-cmd and then "put filename.jpg" or whatever) No idea how to set debug there besides adding -vvv to the command. I also checked the log folder (root/.megacmd or whatever). Nothing there

I noticed that airlivedrive . com has the same problem as rclone (no modified time, only time added). Like rclone, it also takes a while to mount when there are many files in the drive.

Similarly, foldersync on Android takes 3 minutes to start the sync when there are ~30k files in my account. But it sets the modified time correctly

Megasync/Autosync, on Android also sets the modified time correctly and syncs faster (takes 30 seconds to initiate).

But they're all closed source :frowning: still, now we know that it's definitely possible, right?

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