You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am dealing with customers, who sometimes delete files on their Nextcloud in huge quantities by accident. Restoring thousands of files through the webgui is pretty tedious. I know, you can select all files, but still it doesn't work clean for so many files, since it brings the web interface to it's limit (in my experience).
Now my suggestions would be to add a command line option to solve this easier in the future. Personally I'd add the option restore to the existing php occ trashbin command. Some useful arguments to define would probably be usernames to locate the correct trashbin and a verbose option.
Thanks for your work.
Best regards,
Tim
Reacted by Jonas, Andrin Schmuker, Robin Bühler, Simon L., Hartmut Seichter, Marc Koch, ajaskiewiczpl, Guillaume Colson, jabdoa2, Tobias Brunner and 5 more
I have the same issue on a server for a customer. The webUI is just too slow to restore all these files.
As I did not find any commands to restore the whole trashbin for a given timeframe, I made a snippet in Chrome to automate the click on "restore" for all the files deleted for a given period.
Definitely not perfect, but hopefully it can help someone.
Just change the dates in the function call at the bottom of the snippet.
You must be on the trashbin page, logged in with the user you want to restore files for.
Use at your own risks - this is only meant to help other admins with the same issues.
Edit: modified the timer between each restore (2000), as faster was making NC miss some files.
Edit2: debugged the code below as I had a similar issue with a customer.
// NEXTCLOUD RESTORE// I have the same issue on a server for a customer. The webUI is just too slow to restore all these files.// As I did not find any commands to restore the whole trashbin for a given timeframe, I made a snippet in Chrome to automate the click on "restore" for all the files deleted for a given period.// Definitely not perfect, but hopefully it can help someone.// Just change the dates in the function call at the bottom of the snippet.// You must be on the trashbin page, logged in with the user you want to restore files for.// Use at your own risks - this is only meant to help other admins with the same issues.letrestoreFiles=asyncfunction(opts){letsleep=asyncfunction(timer){returnnewPromise(res=>{setTimeout(()=>{res(true)},timer)})}// console.log(opts)if(!opts['index']){opts['index']=0}index=opts['index']console.log(`PAGE: ${index}`)for(vari=0;i<opts.preScrollPagesCount;i++){awaitsleep(1000*opts.waitBetweenScrolls)$("html, body").animate({scrollTop: $(document).height()},1000);}awaitsleep(1000*opts.waitAfterScroll)letrestoreBtns=$('.action-restore')letstart=moment(opts.startDate)letend=moment(opts.endDate)for(vari=0;i<restoreBtns.length;i++){letbtn=$(restoreBtns[i])letsection=btn.parent().parent().parent()lettr=section.parent()letpath=tr.attr('data-path')letfile=tr.attr('data-file')letmtime=tr.attr('data-mtime')if(!mtime)continue;letmMoment=moment(parseInt(mtime))if(!(mMoment.isBefore(end)&&mMoment.isAfter(start)))continue;console.log(`Restore: ${path}`)awaitsleep(opts.waitBetweenClicks*1000)btn.click();}awaitsleep(opts.waitBeforeLoop*1000)opts['index']=opts['index']+1returnrestoreFiles(opts)}clear();// // Sort by Ascending deleted time (recent => old)// $('#modified').click()// $('#modified').click()restoreFiles({startDate: '2021-03-30 11:00:00',endDate: '2021-03-31 13:00:00',waitBetweenClicks: 5,waitAfterScroll: 10,waitBetweenScrolls: 1,waitBeforeLoop: 4,preScrollPagesCount: 2})
I need this so badly after my desktop client decided to mark files as deleted instead of freeing up disk space 😅
PS: Doing it in bulk via the GUI spawns a lot of connections, the server even runs out of memory (16GiB), starts swapping, dropping connections and spawning errors. (Despite me disabling filelocking for the restore).
Maybe some kind of rate limiting or optimization could help here.
Bulk restore is unusable like this 😢
Activity
alejandroscf commentedon Apr 16, 2020
That would be a great option. I just had to restore a backup from the previous day because with the webui was impossible.
bseclier commentedon Dec 7, 2020
It would be a great feature, indeed !
benoitlavorata commentedon Dec 23, 2020
I have the same issue on a server for a customer. The webUI is just too slow to restore all these files.
As I did not find any commands to restore the whole trashbin for a given timeframe, I made a snippet in Chrome to automate the click on "restore" for all the files deleted for a given period.
jabdoa2 commentedon Feb 7, 2021
As I have been hit by nextcloud/desktop#260 as well this would be useful to me too.
szaimen commentedon Jul 2, 2021
Currently no one is working on this one, so it would be great if someone of you could open a PR to implement this :)
martijnvandijk commentedon Sep 24, 2021
You, @benoitlavorata just helped me out big time with your snippet! Thank you so much for sharing.
Tie-fighter commentedon Feb 7, 2022
I need this so badly after my desktop client decided to mark files as deleted instead of freeing up disk space 😅
PS: Doing it in bulk via the GUI spawns a lot of connections, the server even runs out of memory (16GiB), starts swapping, dropping connections and spawning errors. (Despite me disabling filelocking for the restore).
Maybe some kind of rate limiting or optimization could help here.
Bulk restore is unusable like this 😢