rsyncrsnapshot

Why does rsnapshot not exclude directories I specify?


I am setting up backups with rsnapshot but I'm having trouble with the excludes. I have read a lot about it and I know that there are important differences in rsync regarding the use of slashes. But I don't get why this doesn't work. My (simplified) folder structure inside /path/to/files/my_files/ is something like this:

folder1
folder2
folder3
-- subfolder1
-- subfolder2
folder4

I want to exclude folder1 here. The rsync command in /etc/rsnapshot.conf is something like:

backup  remote_user@remote_server:/path/to/files/my_files/    my_files/

While my exclude file (also defined in /etc/rsnapshot.conf) looks like this:

- /folder1

I also tried - folder1, - /folder1/, and - folder1/. But none of them works the way I want. For example, using - folder1 excludes the folder I want, but also every other folder whose path includes the string folder1. On the other hand, the others don't exclude the folder I want to exclude.

This really drives me crazy, I have read so many examples and it feels like I tried every possible combination - but to no avail. Can anybody tell me what I'm doing wrong? Is there something special about excludes in rsnapshot that makes it different from a simple rsync call? Because there I have no problems.


Solution

  • rsnapshot invokes rsync with the --relative option. One of the things that this changes is the way include/exclude rules work.

    Try this:

    - /path/to/files/my_files/folder1