Restore all files that were deleted today

I’m stupid.

Nextcloud version (eg, 20.0.5): 17.0.10
Operating system and version (eg, Ubuntu 20.04): Ubuntu 18.04.5 Unfortunately on a Host where I don’t have sudo access.
Apache or nginx version (eg, Apache 2.4.25): replace me
PHP version (eg, 7.4): 7.1.33

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” in my trashbin.

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”.
I can see all of them in the database and wonder if I could easily restore them via console.

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.

For everyone with a similar problem.

I’ve written a script that you can run with php to restore all files from a given date (and later) over the WebDav API of Nextcloud. You can specify how many parallel connections you want to run. This makes it quite fast. 10k Files take about 8h.

Heres the script git repo

Write an issue if it does not work.

1 Like