Nextcloud client deleted local files that it was supose to ignore

bad situation… once you are try to recover recover with testdisk and photorec I assume no backup is available? try to recover from both hard disks - server and client side. and avoid any write to the disks until you finish the recovery or give up…

No that’s just the thing, this is a folder that was not supposed to be on the server, it was marked to be ignored and strangely got deleted locally without ever being uploaded. It seems that the NC client tried to sync the ignored folder and could not do it so it just deleted it instead. Everything on the server is backed up. But yeah I’ll continue to do some reading on recovery and if I cant find a solution I’ll just have to accept it is gone.

Hello @nimkha

Sorry to hear that you probably lost data. Nevertheless, here are a few thoughts on this, in order to hopefully avoid such a situation in the future, also for others who are reading this.

You moved a folder on your computer, that you don’t want to synchronize with your Nextcloud into a folder, that is already synchronizing it’s content with the Nextcloud, only to exclude it from the synchronization afterwards? That doesn’t make a lot of sense to me. As I understand the “ignore” function, it is primay meant to ignore folders on the server, so that the sync client does not try to download them to devices, that otherwise would run out of storage space.

What exactly happened and what can you do?

The files in this folder were probably never fully uploaded . So there is no point in trying to restore the files to the server. The sync client probably started to sync as soon as you created or moved the folder and then canceled the sync when you set it to “ignore”. Therefore only 200KB were found on the server. So if you have a chance to restore the files at all, it would be on your computer.

How to avoid this in the future:

  1. Only move files into a folder that automatically syncs with Nextcloud if you want them to be synced with your Nextcloud and keep everything else in separate folders outside of that folder.
  2. Only use the ignore function to prevent folders from beeing downloaded and not the other way arround
  3. Always backup important stuff
  4. Always backup important stuff
  5. Always backup important stuff
1 Like

Hi @bb77 thanks for the response but I probably should describe my situation better.

I am using the NC desktop client to sync my local files and folder to the server.
After installing the desktop client I choose which folders to sync with the server.
When I chose a folder I can then uncheck any sub-folder that I do not wish to upload and sync with the server.
In my case, I have one sub-folder that is unchecked and therefore is not uploaded.
This has worked fine and as intended since last summer.
Now, a couple of days ago I noticed the one sub-folder that is unchecked is empty. I then check the server and see that the sub-folder which is unchecked is uploaded but with only 3GB of the content.
I do not know how and why, all of the sudden, the NC desktop client tried to upload the sub-folder which is unchecked.

In the image, it is the last folder which is the unchecked one that has lost its content. This setup/structure has been the same since I setup the NC desktop client

I would not use it like that. But it is of course up to you.

Why not put all the folders that have to be synced in a seperate folder and leave the ones that you don’t want to get synced outside?

The problem with your setup is, that anytime you create a new folder in /media/deskto/Seagate it begins with synchronisation right away and you have to uncheck the folder afterwards.

From now on I will absolutely do it like you suggest.

I just don’t understand how this happened now and not earlier since I have been using it like this for almost a year now creating/deleting/editing files and folders, and if anybody might have known where the files might be or how I could get them back.

I can only guess…

Maybe an an incomplete upload of the folder was accidentally synchronized back somehow. What I don’t understand is why it still shows 3,2GB if the folder is empty?

Now I finally got the issue: you had a sub-folder within Nextcloud folder on the client, which you excluded from sync and this got deleted! My apologies.

My personal stand point would be not to setup it this way… sounds non-intuitive for me… maybe not even supported or at least not expected by developers. If you feel this is valid scenario maybe it’s worth opening an issue on GitHub to clarify if this scenario is supported and at least make the devs aware this case exists…

Since the the desktop client started the sync process by itself it managed to upload 3,2GB of one file (which is btw still incomplete), and also uploaded some empty folders before ignoring and deleting the rest.

The thing is these are very large files and folders, between 10-50GB, I think if they were smaller it would maybe have managed to upload them without issue. I have noticed before when trying to upload large files above 10GB that it causes problems even though I have no restriction on file size.

Just to avoid any confusion I still did not ask the desktop client to do any of this

I honestly can’t understand how that even worked, the way you did it. When I check out a folder, it disappears locally in my file system and is only visible in the Nextcloud web interface.

The explanation for the disappearance of the files could therefore be, that the check mark was set again in the meantime and an incomplete upload was then synced back from the Nextcloud to your local filessystem.

Yeah I’m starting to understand that I have misunderstood the concept of unchecking sub-folders. I will avoid any form of unchecking sub-folders in the future.

Do you have any suggestion of how I can exclude any files in the future that might be part of a folder. For instance I was working on a project regarding password analysis and wrote some scripts to perform some tests. In this folder I had a file containing passwords that was 30GB and I want to ignore just this file?

Ignoring specific files isn’t possible, afaik.
If the file has a special file ending you might be able to ignore the file via the ignore-list, though.

Aha, I think I maybe understand what happened. Unchecked folders are supposed to get removed/deleted locally by design, so when I started the sync process with an unchecked folder it should actually have been deleted from the very beginning?

I see, thanks for clearing that up

I think I am wrong. You can choose your own pattern which can also be a filname in the ignore-list, as far as I see it. Best is if you try it out yourself.

1 Like

Ok I will do that, thanks again

Yes and no. You can uncheck them if you don’t want to get them synced from your Nexloud to your local machine. That can make sense on a device with limited storage space. But always look at the server as the primary storage. Synchronization is not a client to server backup solution. In fact it is NOT a backup solution AT ALL.

Ok, it is starting to get a little clearer for me now. I have started the whole sync process in the wrong end, I started with an empty server syncing all the content I have locally. What should have been done is upload everything I had manually and then setup the desktop client.

It’s perfectly fine to do it that way. But you have to keep in mind, that the local folder wich is defined as the synchronization target for your Nextcloud account, basically is a mirror of the file structure in your Nextcloud. And as soon as the synchronisation is active, all changes on both sides will instantly get downloaded respectively uploaded.

If you uncheck a checkbox in the folders list, you basicaly say to the SyncClient: “Please do not sync this specific folder ON THE SERVER with my local file system anymore!” The folder then disappears from the local file system and remains on the server. But vice versa you cannot exlude files or folders from getting uploaded if you put them inside the folder that is defined as as your local synchronisation target. You can only exclude them from geting downloaded again. That’s because a folder has to exist on the server, in order to apear on that list.

Nope. What you should NOT have done is place a folder inside the synchronisation target, that you don’t want to get uploaded to your Nexcloud.

1 Like

Ok, I understand better now.

Thank you for all your help and explanation. I have learned a lot

1 Like