Deleted a bunch of files accidentally -- need help with restore

Haven’t included any extensive details because I’m not facing a bug or anything, I just need advice on how to proceed:

Nextcloud version (eg, 12.0.2): 15
Operating system and version (eg, Ubuntu 17.04): Raspbian

A couple days ago I deleted a bunch of files, without meaning to, from my Nextcloud:

  • These files were within a Cryptomator vault, which was unlocked at the time
  • I stopped the process almost immediately
  • Most/all of the files I care about within the vault, it seems, had already been deleted on my PC, and the NC server had already synced this

Despite this, I see a bunch of files in my trashbin (over 1000 folders and files, all encrypted with Cryptomator). My instance is very slow (it’s running of an rPi 3+) so it hasn’t been able to handle restoring 100s of folders at a time (and anyway, NC it seems doesn’t offer any tools for mass-selecting files between certain dates, and since I don’t want to restore my entire trashbin of the last 30 days I’d have to manually select about 1000 folders to restore).

How do you guys recommend I go about restoring my files? The ideas I’ve had so far:

  • Just manually sit on the website restoring the files individually. That’ll take hours through – selecting more than one folder at a time doesn’t always update properly
  • I do have physical access to the server. I can access the trashbin on the local storage device, but I’d have to manually move those files over, and moving them to their initial locations matters for Cyrptomator (I wouldn’t know where to move them). Does occ have a way of doing this instead?

Does anyone have any ideas of what I can do? Or is it likely the files are lost forever?

Thanks

I’m not familiar with Cryptomator. Is that something like TrueCrypt?

If the files were stored in a container like TrueCrypt, you should be able to actually roll back the container file in Nextcloud.

Cryptomator is not a real container, instead it stores all files encrypted in a file/ folder structur.
Let’s say you have:

Test-folder1
    - textfile.txt
    - htmlfile.html
    - jpegfile.jpg

Test-folder2
    - videofile.mp4
    - musicfile.mp3

On the hard disk you can find a structure like this (the information in brackets is just what I added for better understanding):

Cryptomator
    - d (folder)
        - Dj (empty dummy folder)
        - Ph (empty dummy folder)
        - Tf (folder)
              - pslj234lhasjJHAshjaslk723Ka (folder)
                    - Iams0f82jnldfklja=-223maa- (encrypted file)
                    - d234hijlsdf98H24h(23ß3a023a (encrypted file)
                    - ja§83jas=48(as3Jahe (encrypted file)
        - Uv (folder)
              - jasdoi34nJAsjrjlLAS3adjsd (folder)
                    - kJe329Aaskvw(3§=lasM (encrypted file)
                    - kjwqenljxdf(jE§Ljasklalasdlkwheh (encrypted file)
        - Qx (empty dummy folder)
    - masterkey.cryptomator

So it is a pretty wild structure and every file is encrypted on its own, the file extension is not visible.
What I believe you could do, is simply restoring all your deleted folders back into the Cryptomator folder on the disk. While there is the one password for your Cryptomator Store, all the files and folders should still be decryptable with that password, when the encrypted files are back in the old folder structure.

Therefore I would do:

  • Backup the old folder of Crpytomator (Copy the whole folder elsewhere)
  • restore the folders and files from your trashbin (should move them back to the Cryptomator folder where they previously were)
  • again create a second copy of the Cryptomator folder, just to have a second backup with the restored files, while they are no longer in the trashbin and that folder is probably the only one holding your old files now
  • open the Cryptomator Store and see if the files are back
1 Like

Thanks so much for your detailed reply.

I’m a little shocked, because it seems to have worked perfectly. I seriously didn’t expect that. Followed your instructions and I’ve got all my files back!

It seems some might be corrupted, but thankfully none that I actually care about. I’m extremely lucky – time to make some backups!

Thanks again!

1 Like

I’m very glad to hear you got your files back :slight_smile: :+1:
Backups are a very good idea :wink:

You are very welcome! Have a nice weekend!

1 Like