Client sync with old data

Nextcloud version (eg, 20.0.5): 27.1.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04

The issue you are facing:

I have a running nextcloud and one of my pc with nextcloud client was down for a couple of months.

Before turning it off, I removed the sync folder from the client but kept the data directory on the filesystem.

When I turned on the pc, I’ve re added this not empty directory as sync directory, the idea was to spare some bw for the sync, but of course this was a bad idea.

The issue is that this uploaded a bunch of files to the server. Those files were erased or moved from another pc’s nextcloud client.

Is there a way to revert the change? Is there a way to export the activity log of the latest 24h so I can script something to remove all the newly uploaded files?

Normally, the client sees that the server has changed since and it will just adapt the folder’s content to what is on the server. So it will delete the stuff from you local folder. In case not everything has been uploaded, it might upload it again.

If you want to be sure nothing is lost, I would copy the file somewhere outside the sync folder. And on the server you can do a backup just before.

On the server side, I’d do a backup when I know there is one process that perhaps creates a lot of trouble. You have a trash bin to recover files (you could use the API: Trashbin — Nextcloud latest Developer Manual latest documentation). But moving or overwriting files is a bit complicated. Perhaps moving you could extract from the logs somehow, but that could be a project for an app…