Exclude folders and subfolders with ".nobackup" file

Hi all,

I’m trying to backup my system but want to exclude certain folders, is it possible to include a generic .nobackup file in those folders to exclude those folders ?

Yes, it’s right here in the documentation about excluding files.

Thank you kindly for linking.

Is it the --exclude-if-present .nobackup flag that I’m looking for ?

ok so I got it to work with the following command

restic backup -r rclone:googlecrypted:backup --verbose --exclude-if-present “nobackup” --use-fs-snapshot backupfiles

The only problem is, restic backups the empty folder and the nobackup file itself. Is there a workaround to stop this ?

Why don’t you use another exclude option?
I prefer the exclude file list where I put in all the files and folders I want to exclude.

I’m trying to back up 3 hard drives on my pc with windows systems files and steam libraries and other folders that don’t need backing up. Easy to drop a nobackup file in these directories.

Alternatively, I may just put all the folders in a text document and use that in the exclude command

This is what you want. Imagine the following:

  • You back your system up the way you did now, but with restic being what you suggested you want, not including the folder and the nobackup file you use for the exclude feature.

  • Your system burns to the ground, and you restore it from the backup.

  • You use the system and part of that creates one or more of those previously excluded folders anew, and files in them.

  • You start backing up again, the same way as before.

What will then happen is that the nobackup files are no longer present, and any of those folders you previously excluded but that has now been recreated without nobackup files will be backed up in their entirety.

The fact that restic backs these folders up with only the nobackup file is good, as it keeps your backup configuration working the same way as before after a restore.

With that in mind, if you still think this is a problem, can you please explain what the actual problem with having those files backed up is? As far as I can see, it’s at most just cosmetic.

You should consider the nobackup files part of the data you want to back up, not some meta thing you don’t want backed up :slight_smile: