Exclude-if-present only once?

Hi!
Do I need to specify only once --exclude-if-present no-backup.dat in my command if I’m providing more paths? This excludes will work for all paths or only one?

restic --verbose backup --exclude-if-present no-backup.dat srv/path1 srv/path2 srv/path3 

Also do it looks in each subdirectory deeper in paths like (srv/path2/sub/sub/sub) ?
And last - should I provide --exclude-if-present no-backup.dat with ' ' around no-backup.dat ?

Correct, you only need to specify it once for restic to know that whenever it encounters that exclusion file in a folder it shall exclude that folder’s contents from the backup. Note however that it does back up that exclusion file, but that’s the only thing in that folder which will be backed up.

If it encounters a folder with that exclusion file in it, it will exclude that all other content than the excludion file itself in that folder, which also means it does not look further at or into any subfolders in that folder. I believe the short answer to your question is then “no”.

This isn’t necessary at all, but it will not hurt either, normally your shell will just remove the quotes before handing the filename to rustic. I’d recommend not using quotes and keeping the filename without spaces or other special characters, like you do in the examples you wrote.

1 Like

Thanks a lot! It was very helpful. Things work as expected!

1 Like