Rclone teamdrive undelete

Anyone know a good way to undelete data on a teamdrive? All the info available on the forum are outdated / not working or slow due to copying media etc.

I've mounted a second mount of my teamdrive with the --drive-trashed-only flag and the data shows up fine, it should be moved back to the original mount again but I can't for the life of me get it to work. if I do a move using rclone move --drive-trashed-only --drive-server-side-across-configs recovery:directory to teamdrive:directory no content shows up, my guess is because the file still got the "trashed" flag. When I do a rclone copy --drive-trashed-only --drive-server-side-across-configs recovery:directory to teamdrive:directory it starts out fast with server side copy but after some hours slows to a crawl. Moving it via the web interface also doesn't work. I've tried an untrash go binary from here but its from 2018 so probably not working anymore, wasn't doing much for me.

hello,

when you posted, you should have been asked for information......

Probably what I should do is make an untrash backend command. Can you link where you got the untrash binary from and I'll take a look.

I tried the binary from B4dM4n at FML: accidentally trashed everything

While I know it's a niche feature a documented way of untrashing would be nice. The GUI of drive is a mess when using rclone and encrypt. I've resorted to merging the files into my storage cluster via some bash magic so all should be well.

I had a go at implementing an untrash backend command based on @B4dM4n 's work - we didn't have the backend command framework when he wrote that otherwise he would have probably put in there himself!

v1.52.2-283-ga8e67318-fix-drive-untrash-beta on branch fix-drive-untrash (uploaded in 15-30 mins)

untrash

Untrash files and directories

rclone backend untrash remote: [options] [<arguments>+]

This command untrashes all the files and directories in the directory
passed in recursively.

Usage:

This takes an optional directory to trash which make this easier to
use via the API.

rclone backend untrash drive:directory
rclone backend -i untrash drive:directory subdir

Use the -i flag to see what would be restored before restoring it.

Result:

{
    "Untrashed": 17,
    "Errors": 0
}
1 Like

Testing it now and seems to work fine! Running it on a not so important directory and it's untrashing it without any issues. I assume this doesn't do anything with limits imposed in gdrive / teamdrive as it's just setting the file from trashed to not trashed?

I'll run it on the rest as well, beats having to copy it all :wink:

1 Like

Great!

It is just changing the metadata on items so shouldn't do any transferring.

Thanks for testing!

I've merged this to master now which means it will be in the latest beta in 15-30 mins and released in v1.53

Perfect! Thanks for the quick implementation. I'm running it now on the mount with --drive-trashed-only and it's going nicely, got the same one mounted without --drive-trashed-only and you can see the dir size going down on the one with --drive-trashed-only and going up on the one without --drive-trashed-only.

While it's always better to make sure nothing catastrophic can happen to your data, a way to easily undelete it via rclone is a godsend.

And last tip: ALWAYS check your variables and test your end command before commit, running it for a day and come back to missing a chunk of data :wink:

1 Like

@ncw, maybe it is possible to make that this command would be passed from crypt (especially), chunk, cache (and other possible ones) backends if they are all encapsulating drive backend bellow them? That would be really awesome addition.Thank You.

To use it with crypt you'd have to work out the underlying name of the directory you wanted to undelete. Otherwise it should work fine.

I have worked out how to wrap backend commands for crypt but this isn't the first time this had come up.

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