Restore all deleted files of today

What happened:

I have a bunch of data synchronised with my Server Instance.
When I tried to synchronise another Client that had most of the data already, it started to delete the difference on the server.
Now I have a lot of files (>10.000) that are deleted.

What I tried:

Restore them via Browser but there are simply too many files to load.
Additionally, there is an error saying “Error while restoring file from trashbin”.

What I want:

  1. I only want to restore files that where deleted today
  2. I want to restore them without the browser since this does not seem to work.

Thank you for any help. I don’t want them files to be lost.

Hi tobi1,

One of the ownCloud developers created a trashbin recovery tool, which is available at GitHub - JanAckermann/owncloud-restore-trash: Restore deleted files from the trash and discussed in Virtual File Sync no longer working properly · Issue #8295 · owncloud/client · GitHub. FWIK the restore may take quite some time, hovewer ~10.000 files is not a very big number for ownCloud. This tool might be suitable for you. As it states in README.md you’ll have to install the composer package first.

To be on the safe side, you might want to test this with a database copy first.

HTH

Thank you!
However, I’ve already tried this tool. It seems like it does not work.
First I had to define the trashbin URL to /remote.php/dav/trashbin/<username>/trash/. But now it only finds 2 files to restore + it says 412 Precondition failed when it tries to restore them.

I’ve already made a backup. It seems like it should be very easy to restore, since all files are in /files/trash and the database contains all original locations in the files_trash table.
But I don’t know how I should restore the files since I don’t know about any side-effects.

You say 10.000 files is not a very big number for ownCloud… However restoring ‘deleted’ files seems not to work.

It looks like I’m lost here.

Hi again,

I see, the recovery tool is not working here any longer as well. Sorry, I did not notice that something obviously had changed.

Out of curiosity I deleted 10.000 files in a testing instance as well and found out the new web frontend Web (Docs: Deploy as an app in ownCloud 10 | ownCloud) could be a workaround.

In my test I had set the deleted files page to display 1000 items. Then I checked the “select all” checkbox and clicked the restore button. The frontend gave up very fast and soon would “hang”. I ignored the notifications which did not reflect the actual state.

Instead I monitored the apache logs for lines like
"MOVE /owncloud/remote.php/dav/trash-bin/test/7526 HTTP/1.1" 201 750 "https://localhost/owncloud/index.php/apps/web/index.html"
When they stopped I closed the tab with ownCloud Web and opened the very same url in a new tab.
In my test case this procedure put back all files to its original place.

I’m sorry I cannot help better, but maybe this workaround is feasible for you.

@cdamken @dmitry what would you suggest in such a case?

Thanks for your effort!

I’m extremely stupid. Even though I use the owncloud desktop client, I noticed that I run a Nextcloud Server Instance. Haven’t checked in a while.
Obviously the restore script did not work. I had to rewrite it and added a multi_curl option to make it faster.

I was able to restore all needed files. 10k files in about 5,5h.

You are running the wrong Cloud solution, probably you should try to use the correct one, please don’t add links to that wrong solution.