Search

Move changed files to a separate directory (Linux)

I have previously used hardlinking and rsync to backup my systems. I now have a lot of hardlinked directories with almost the same content in folder structures such as etc.0, etc.1 etcetera (etc.0 being the newest) up to 60.

Cleanup script follows:

#!/bin/bash
 
for i in {1..60}
do
        rsync -a --verbose --compare-dest=../etc.$((i-1)) etc.$i/ etc.diff.$i
        find etc.diff.$i -depth -type d -empty -delete
done

Leave a Reply

Your email address will not be published. Required fields are marked *