Re: How to restore, overwriting existing files but not removing other files

Eric Lavarde <[email protected]> Sat, 20 Jan 2024 13:59:16 +0100
Newsgroups gmane.comp.sysutils.backup.rdiff-backup.general
Message-ID <[email protected]>
Hi,

On 19.01.2024 03:22, Exuvo wrote:
> Some of my files got corrupted in /destination ex /destionation/a and
> /destionation/b.
> I have rdiff-backups of a few of the directories in /destination but
> not all via --exclude lines ex /destionation/c.
> Restoring with "rdiff-backup restore backupDir /destination" says
> ERROR target path /destination exists and isnt empty, call with
> --force to overwrite.
> So i tried with force but that then starts deleting everything that
> was excluded instead of just overwriting conflicts.
> How do i get it to restore the backup but not deleting everything that
> was not in the backup?
> 
> I still have my tape backups of everything rdiff-deleted so nothing is
> lost but that is going to take two days to restore.

There are multiple ways to do it, here as examples:

mkdir /tmp/from
for x in a b c; do echo original > /tmp/from/$x; done
rdiff-backup backup /tmp/from /tmp/bak
for x in a b c; do echo modified > /tmp/from/$x; done
# if you have few files to exclude (multiple excludes are possible)
rdiff-backup --force restore --exclude /tmp/from/c /tmp/bak /tmp/from
# if you have few files to include (multiple includes are possible)
rdiff-backup --force restore  --include /tmp/from/a --exclude \** 
/tmp/bak /tmp/from
# if you have only one file to restore
rdiff-backup --force restore /tmp/bak/a /tmp/from/a

So, basically, as you restore, excluded files are being simply ignored 
and left alone.

Hope this helps,
Eric
-- 
Eric de France, d'Allemagne et de Navarre