Is it possible to restore the oldest version of a file in Google Drive

Google Drive supports native file versioning. I assume when uploading, rclone will just create a new version.

Is it possible to restore/copy back only the first version of a file?

It will, yes

You'll have to do that via the web interface.

Darn it! I've got TBs worth of files where, at some point in my daily sync, the source files got corrupt. So I was looking to just download the very first version of each file. I'll see if I can write a Google Drive API script to restore all files to their first version.

Thanks!

Good luck.

be advised that if you want to be better prepared against things like this in the future, rclone has a --backup-dir option you can use.
https://rclone.org/docs/#backup-dir-dir

With this it is not hard to basically create a full versioning system in rclone itself. It may technically be redundant for a cloud-host that has versioning, but it can make for a system that is a lot easier to manage and restore from in the case of accidents like this.

A bit down in this thread is a script I made a while back for another forum user if you are interested to see a relatively simple (but effective and functional) way of scripting this. Perhaps you will find it useful:

2 Likes

:frowning:

I had a quick look at the google drive revisions API... It looks like rclone would have to list the files then call the revisions API for each file which looks quite inefficient. I couldn't see a way to get revisions to turn up in the listings which would be ideal.

1 Like

This is a runtime only option, correct?

If you mean if it's only available as a flag then the answer is yes - at least currently. I hope I did not misunderstand the question?

As with all other non-remote-spesific options this only exists as a flag and can't be put into the config.
This is a limitation of the configuration structure as I understand, and I believe NCW has commented on this saying that he is aware that it isn't ideal because a lot of people want to put various options in the config to use as a default. Apparently this will require a fairly large restructuring though, which is probably why it hasn't been a high priority yet. It will come in time I am sure :slight_smile:

Until then, it's easy enough to just put the flag in your commands in a script though.

1 Like

Yeah. I have a script I wrote that uses rclone to backup to GD. But, I neglected to add logic to make backups of anything it overwrites. I've added that logic now and it will also email me a list of files that were "updated". Most of the time my files wont change so if files are being updated that means something got messed up. Thanks!

And I saw your script. Very nice. I'm on Linux so I can't use it but my script does mostly similar things.

Yeah. I was looking at the Drive API. It's not worth it -- for me or anyone. I was able to find other ways to recover my data. Well most of it, whats gone is not worth the energy to recover.

1 Like

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