Hello,
I have been using the --iexclude-file flag to tell restic to ignore the usual temporary files and folders. But for some folders, I want to exclude everything except specific sub-folders, like in Backup public ssh keys but do not backup private ssh keys - #3 by uli and as described in the docs :
# excludes.txt
.steam/*
!.steam/steam/steamapps/compatdata/*
!.steam/steam/userdata/*
Games/*
!Games/**/Documents/*
!Games/**/Saved Games/*
.local/share/flatpak/*
!.local/share/flatpak/overrides
But, when I check the snapshots, I have empty .steam and Games folders, while .local/share/flatpak/overrides isn’t and contains files. I have tried swapping the exclude and include lines, adding extra * to includes and removing the * at the end of excludes do not create empty folders.
I run backups using the following command:
restic backup $HOME \
--exclude-caches \
--iexclude-file excludes.txt
Version
$ restic version
restic 0.18.0 compiled with go1.25rc2 X:nodwarf5 on linux/amd64