Restore directory to previous state
6,543
Reverse the RSYNC. So swap around dir1 and dir1.back then add the delete flag to ensure it removes files as appropriate to make sure it properly syncs and not just ignore files that weren't present in dir1 originally.
rsync -avz --delete dir1.bak/ dir1/
Related videos on Youtube
Author by
Gilles 'SO- stop being evil'
Updated on September 18, 2022Comments
-
Gilles 'SO- stop being evil' over 1 year
I have an approximately 1TB directory with subdirectories
dir1
. I have made anrsync
backup copydir1.back
.How can I efficiently restore
dir1
to the state ofdir1.back
- that is, replace files indir1
with those ofdir1.back
if they've change and deleting any new files indir1
? Given its large size,cp
/rsync
of the entiredir1.back
is highly infeasible.If I'm not mistaken, this might be possible using
rsync --check-sum
?