Exclude new files by age/date/time

I would like a feature to exclude/ignore files by the age of the modification date.

I only want to backup/archive files older than X number of days/month.

Thank you for consideration.

restic allows to backup files of your choice - have a look at docs. Included example should give you an idea how you can fulfil your requirement:

find /tmp/some_folder -regex PATTERN -print0 > /tmp/files_to_backup
restic -r /srv/restic-repo backup --files-from-raw /tmp/files_to_backup

for example only to include only files older than 2 days:

find /tmp/some_folder -mtime +2 -print0 > /tmp/files_to_backup

Note that --files-from* is not a way to include/exclude, but a way to specify multiple sources from a file list.

This leads to trees containing only exactly the given files, but also leads to snapshots which have each of the files in the paths field - and this has consequences when grouping by paths, e.g. in forget or when using a parent snapshot. Also having a potentially very long list of files within your snapshot file might be irritating…

Thx for the insight. In such case it would be better to create a list of files newer than given time and use it as exclusion list.

Yea it almost seems like the better thing to do here would be to tar up the files to be backed up, and then let restic process them. Of course the problem with that is now you’ve got two things you’ve got to manage when it comes to restoring a file (restic and then untar)

Well, no, this is not what I would suggest. I’d suggest for current restic to use (maybe generated) exclude/include files and calling backup with a path.
Better would be to allow giving a file-list but still setting a path or more advanced include/exclude options - but these are all things-to-be-implemented.