1

I have a bunch of old backups, each of which is a directory containing incremental changes from the previous backup. There are arbitrarily nested directories and files in each directory. I need to move them all into a single directory which merges all these changes. I am starting with the oldest backup first, and need to preserve each version of files which appear identically in multiple backups. The files need to be moved, not copied, although if an empty directory skeleton is left behind in each source for a subsequent delete, that is ok too.

I found this answer which seemed to have all the components I needed, although I had to piece together an rsync command to do everything I wanted. However, it is not working. My command looks like this:

rsync -Ea --link-dest=/tmp/test1/ --remove-source-files -b --backup-dir=/tmp/test2/ --info=BACKUP,COPY,DEL,FLIST,MISC,MOUNT,NAME,PROGRESS,REMOVE,SKIP,STATS,SYMSAFE  test1/ test2/

Note that the info command is my attempt to see what rsync is doing, but even with all possible flags, it is still silent about what files it is creating links for!

But the more difficult problem is that the command is not actually creating any backups! I tried omitting the --backup-dir option and get the same result. I also tried adding --suffix=~ in both cases. No backup files are ever created!

As an example, before running the above command I create "test1/1.txt" and "test2/1.txt" with different contents. After running rsync, "test2/1.txt" has overwritten "test1/1.txt". Since I am using the -b option I would expect the original 1.txt would be moved to a backup file, e.g. 1.txt~.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.