Check/delete of unnecessary/orphan files on backend/remote

Hi guys,

I moved my Duplicati installation to a new PC. It backups a network drive which I unfortunately connected to the wrong folder on the new PC.
So Duplicati started to upload a lot of new files over hours until I saw the mistake.
I stopped the backup, connected the network drive correctly and rerun the backup. It correctly said “no new files to backup” now.

But it seems I have now a lot of unneeded files on my backend (MS Onedrive) from the hours of upload. I see at least a lot of files in my Onedrive which got created/modified over the last view hours.

I was hoping Duplicati finds such orphan files on the backend side and deletes them. Doesn’t seem so…

Is there a way I can force dulicati to delete all files not used by its local database from the backend?

thanks
Soko

PS: Unfortunately I don’t know exactly at which stage I stopped the upload process…
PPS: list-broken-files was promising, but didn’t do anything

Was the intent to have the new PC so identical to old that old backup (and history) continues seamlessly?
That would require moving the database (best) or doing Recreate. It sounds like you began fresh backup, because the old database would have found missing files if it was aimed at a blank folder due to accident. What exactly is the destination? I don’t have a clear idea of what Duplicati sees/uses due to that accident.

Are there any old ones there? If all of these are from the accident, then why not just delete them yourself?

That describes everything else in your OneDrive, right? You wouldn’t want Duplicati to delete all other files.

I can’t find that message. In GUI run, nothing to backup should just finish fast without backing up anything, however it should still validate the remote. Wouldn’t “connected the network drive correctly” look different?

Hi and thanks for taking the time!

My initial post seems to be too confusing. So before I explain the circumstances in detail let me maybe save you time do a simple example which leads to the same question:

I’ve created a new backup of a view files to onedrive folder Duplicati/TEST. Then I’ve manually copied a couple of other random files into the same folder on onedrive.
Duplicati doesn’t touch these files at all after a rerun of the backup.

So is there a way to tell Duplicati “Delete all files in your backup-destination-folder that don’t belong to the backup”?

And here is the full story that leads to the simple example above:

On my old Windows PC Duplicati was backing up a network drive Z:\ since years. Z: was connected to \server\share\pics which holds 20 years of photos.
The Destination of the backup was OneDrive v2 with the “Path on Server”=Duplicati/pics.

On my new Windows PC I’ve installed the same version of Duplicati in the same directory. The windows PC has also the same Windows user.
Then (of course :wink: ) I’ve copied the database from the old PC to the new one. Duplicati showed me the backup and the versions as on the old machine.
Now I’ve made the mistake on the new machine to connect Z: to \server\share instead of \server\share\pics.

Then I’ve made the mistake not to test the backup. So the schedule started the backup at 10pm. At 8am on the next day I was wondering why the backup is still running and its uploading files. So I stopped it…

After further investigation I’ve found the wrong Z: connection. Thankfully there is a folder named camcorder in \server\share. So my guess is that Duplicati uploaded all my camcorder files over night and didn’t touch the old backup files on the onedrive.

I corrected Z: to \server\share\pics and rerun the backup. Duplicati didn’t backup anything as no files were changed. So I reckon, Duplicati just added the new files (from camcorder folder) to its database and didn’t touch the (then missing) files in the database. So once I’ve corrected Z: it found them in the database again and all is good.

But now I have all the backup files in my onedrive “Duplicati/pics” folder from the upload of the camcorder folder which I don’t want there.

So how can I force duplicati to delete them?

thanks again
Soko

No, and it sound dangerous not only to random files in folder, but to backups there that use prefix option.

It also sounds like what you want is not deletion of files in destination folder, but un-do of source backup:

The PURGE command (most easily run in Commandlne but potentially a little tricky due to no nice GUI).
Try with dry-run set first might be safer, and be very careful not to accidentally wildcard-delete too much.

There’s much processing between source files and destination. After purge of source files from backup, Compacting files at the backend might run to reclaim the now-wasted space and lower OneDrive usage.

Before asking for purge, you should go into the Restore tree to find the interrupted backup, and see if the camcorder files in fact showed up then and stayed around thereafter. If you want them gone, purge them.

Another way to clean up (maybe a little easier) is to just delete backup versions until the accident is gone. Latest version is always 0, so you can delete those one at a time if there aren’t too many and there’s not newer stuff whose versioning you really want to keep. For DR purposes, I assume you’d resume backup.

OK, I didn’t know about the prefix option and that you can store multiple backups in one folder. So it makes sense (kinda) that Duplicati doesn’t touch/delete files in the backup folder that don’t belong to the backup itself.

After reading your reply and weighing my options I’ve done the following:

  • Login to the website of OneDrive and listed the files in the backup folder by modified date from newest to oldest.
  • As the last backup before the camcorder-backup was days ago I just deleted all files that were modified within the last day.
  • Copied the Duplicati database of the backup again from the old to the new PC
  • Rerun the backup on the new PC: The backup succeeded with no new files to backup

The only thing I’m worried about is, that I’ve deleted too many files. Would Duplicati through an error on a usual backup run if files are missing?

If not the only option I know is to run verify with the all option.

Thanks
Soko

You really shouldn’t do manual file deletes. Files may be modified for various reasons, including compact, where what you did would destroy the backup. Sometimes you can get away with it, sometimes you can’t.

This time it looks like it survived. Duplicati would give errors if it found missing or extra files for the backup.

Yeah… my gut told me it’s not the best idea. But thanks for the background info. I’ve also run a verify with option all successfully with no errors.
So thankfully I’ve got away with it this time.

Thanks again

1 Like