-
-
Notifications
You must be signed in to change notification settings - Fork 757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add stat-based include/exclude #4102
Comments
If somebody is finding this searching for a solution/workaround for borg 1.0/1.1:
Temporarily excluding big files is especially useful for a initial backup(s), which might take a while. |
Note: the first implementation could just limit the scope to size-based include/exclude (but when writing the code, do it in a way that e.g. timestamp-based can be easily done also). |
Beware of race conditions, though (i.e. large files appearing after you've generated the list). |
I have a proposal for how this could be implemented. Rather than a global CLI flag like There's already logic in place to handle prefixes (for So, to exclude files over 100M from Downloads folders, you would write:
To exclude files over 1G everywhere, you could add this to the command line:
For other stat filters, just replace I have more thoughts, including how to combine multiple filters together, but wanted to put this out there first. What do you think of the proposal? (If it's well received I may take a stab at implementing it.) |
In the end, guess this will need boolean expressions. Operators And the terms in these expressions would be stuff like:
See As a borg backup archive is usually expected to be a full archive containing all the files in the input data set, guess the first step is to look at what makes sense. One obvious thing is being in a hurry and wanting to make a quick first backup, ignoring huge files (like having important little documents and less important *.iso). Other use cases? |
I think for an initial version of this, we could keep it really simple and not worry about boolean operators. I imagine use cases for them would be relatively rare. By the nature of how patterns combine, And multiple negated include rules (
(It's not quite the same as an actual |
The main ones that come to mind are:
|
Another use case that occurred to me: filtering output from
Although I guess this use case can already be accomplished by using |
Yeah. Also this is a bit different to implement (one has to look at archived metadata vs. at stat() metadata from fs). |
it is now (master branch, later borg 1.2) possible to feed so you can do all matching/selecting that is possible via |
Could you please give more details on this or some link to this function? I was searching changelog for "find" keyword without success. |
He's referring to the unix find command. |
Of course, I know that. But how can I use it to filter files and directories to backup? Now the only solution I can think of, is to put output of my specific |
See there: https://borgbackup.readthedocs.io/en/1.2.0b3/usage/create.html |
related: #4972 |
there are tickets about doing file size based exclusion: #902, jborg/attic#330
file size is a stat result attribute, so this is a special case of a stat-based rule.
also in stat result:
so we could add a mechanism to define inclusion / exclusion rules not only based on the file's path/name (as we already have), but also based on comparing stat attributes to given values.
The text was updated successfully, but these errors were encountered: