Skip to content
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

Exclude everything except one #2434

Closed
nunoperalta opened this issue Oct 3, 2019 · 11 comments
Closed

Exclude everything except one #2434

nunoperalta opened this issue Oct 3, 2019 · 11 comments

Comments

@nunoperalta
Copy link
Contributor

nunoperalta commented Oct 3, 2019

Output of restic version

restic 0.9.5 compiled with go1.12.4 on linux/amd64

What are you trying to do?

Trying to exclude everything from one directory except one sub-directory.

For example,

  1. I want to backup everything under /etc/

  2. I want to exclude all files and folders in /etc/pgname/ EXCEPT /etc/pgname/data/

What I tried:

restic.include:
/etc
/etc/pgname/data

restic.exclude:
/etc/pgname

Result is that "pgname" folder is empty in the snapshot.

Any ideas? Is what I want possible at the moment with Restic?

Thank you.

@nunoperalta
Copy link
Contributor Author

Any ideas about this?

@uok
Copy link

uok commented Dec 20, 2019

This does not look like a bug - I suggest you head over to https://forum.restic.net

@rawtaz
Copy link
Contributor

rawtaz commented Dec 20, 2019

As @uok wrote, this would have been a better fit for the forum, as it is simply a usage question and not a bug report or feature request.

There is no --include option to the backup command currently, so you will have to simply build a list of files/files to back up in the relevant folders (you can probably do this using grep) and feed it to --files-from, or do it the other way and provide a list of excludes that does not contain the one folder you want to keep.

@rawtaz rawtaz closed this as completed Dec 20, 2019
@nunoperalta
Copy link
Contributor Author

@rawtaz So... if this option doesn't exist, can this be a feature request, then?

@rawtaz
Copy link
Contributor

rawtaz commented Dec 20, 2019

@nunoperalta What you want to do is already doable, so in that case you'd have to clarify what actual feature you want to add.

If you are looking for an --include like option, this is already tracked in #233 :)

@nunoperalta
Copy link
Contributor Author

@rawtaz I want to be able to include EVERYTHING from:

/opt

But I want to exclude ALL from:

/opt/someApp/

With the exception that I want to include the subfolder:

/opt/someApp/data/

How do I do this?
Do I have to put every single file and folder from "someApp" directory that I want to exclude?
So, every new folder and files added to "someApp", I'll have to keep maintaining and keep growing the excludes file of restic?

@rawtaz
Copy link
Contributor

rawtaz commented Dec 20, 2019

You:

  • Back up /opt.
  • Exclude ever file and folder in /opt/someApp/ EXCEPT /opt/someApp/.

One option is to use --exclude-file to specify those files/folders you want to exclude, another is to use the other --exclude-* options. I'd probably use the former though, with a temporary file, that ought to be easier.

No, you don't have to maintain it manually, you can simply generate this exclude file dynamically right before you back up using something like find or ls along with grep.

It shouldn't be a problem, you can have a huge number of lines in an exclude file. It's not what you were looking for, but it does work.

@nunoperalta
Copy link
Contributor Author

Ok. I guess I can live with an auto-generation script right before the backup, which will loop through the folder and add all the files (except the subfolder I want) to the excludes file.

However, this is over-engineering for something that restic could provide with a simple option...
And that way I wouldn't have to create any script nor having to mess with the excludes file which could simply be a static file.

@rawtaz
Copy link
Contributor

rawtaz commented Dec 20, 2019

On behalf of the restic community, let me deeply apologize for the inconvenience that the lack of these features has caused you. We should have done better in order to serve you a free software that more precisely meet your needs and requirements.

@nunoperalta
Copy link
Contributor Author

nunoperalta commented Dec 20, 2019

@rawtaz It's ok - I'm not complaining about restic not currently having this feature. If no one ever requested it in the past, I can't blame you for not have developed it yet.
However, I would appreciate if you took this request in consideration for future development (and possibly re-open this Issue as a Feature Request).

Thank you very much.

@rawtaz
Copy link
Contributor

rawtaz commented Dec 20, 2019

No worries, I wasn't being overly serious :-)

It's already tracked in a feature request, see the issue I linked to earlier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants