Bernard Brandl <[email protected]> writes: > I'm looking for how to re-establish a directory in the exact state at > the time of a backup job, which means that the application files > written after the backup must be deleted. > > The goal is to restore with Where = / so that the restore is > sufficient, without needing to go through a temporary folder (ie. / > Tmp / bareos-restores) + rsync -a -delete > > If I understand how bareos restore files, it starts by writing the > backup files, putting the permissions, then going back into the parent > folder for permission, and so on. > So, and always if I understand correctly, even with Replace = Always, > the restoration can never destroy the directory, nor the files present > under the tree.
I think you are right. one possible workaround is to touch /tmp/before-restore and after restore is done find /opt -depth \! -cnewer /tmp/before-restore -delete this exploits that Replace = always will update ctime of *all* files restored (I have not verified that this is done). this procedure is completely untested. good luck! hmm, you may get stray empty folders, since ctime of the folder changes when you delete files. so a tweak would be to do this in two passes: find /opt \! -cnewer /tmp/before-restore \! -type d -print0 > /tmp/remove-files find /opt -depth \! -cnewer /tmp/before-restore -type d -print0 > /tmp/remove-dirs xargs -0 rm < /tmp/remove-files xargs -0 rmdir < /tmp/remove-dirs still not tested! :-) -- Kjetil T. Homme Redpill Linpro AS - Changing the game -- You received this message because you are subscribed to the Google Groups "bareos-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/d/optout.
