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

mistake in regex? #2

Closed
tophee opened this issue Feb 16, 2018 · 5 comments
Closed

mistake in regex? #2

tophee opened this issue Feb 16, 2018 · 5 comments

Comments

@tophee
Copy link

tophee commented Feb 16, 2018

Are you sure that this will work:

e:/AppData/Local/Packages/

Shouldn't it be

e:AppData/Local/Packages/.*

(and likewise all the other exclusions in the same format)?

@NiJoao
Copy link
Contributor

NiJoao commented Feb 16, 2018

Regarding the first "/":
If you want to support selecting a users home folder it can't be there.
Otherwise it's irrelevant.

Regarding the last ".*":
(See my very recent post here: gilbertchen/duplicacy#355 (comment) )
As per the Documentation:

When a directory is excluded, all files and subdirectories under it will also be excluded. Therefore, to include a subdirectory, all parent directories must be explicitly included.

The folders are tested first, and their children are only listed and tested if the parent wasn't excluded, which implies that all of the following exclusions do the same, since nothing inside folder/ will be tested.

(^|/)folder/
(^|/)folder/$
(^|/)folder/.*
(^|/)folder/.*$

And keep in mind that Duplicacy uses the MatchString method, that searches for a sub-string in any position. https://golang.org/pkg/regexp/#example_MatchString

@TheBestPessimist
Copy link
Owner

Regarding the first "/":
I don't think there's any reason. I just like the / so that is "yells" it's only these folders!!!!!.

Regarding the last ".*"
I agree with @NiJoao: there shouldn't be a need for that (at least in this case i think).

What I want to do is ignore the content of <anyUsernameHere>/AppData/Local/Packages/.* but anything else in AppData can be backed up as needed.

I wrote (i think) in the file a comment for my reason to ignore that (and opened a bug for duplicacy here: gilbertchen/duplicacy#309): there's some weird skype file which can't be backed up for some reason and duplicacy just stops the backup (so that no data loss occurs).

@tophee
Copy link
Author

tophee commented Feb 18, 2018

Thanks for both of your answers. Yes, I suspected thar the trailing .* is unnecessary but since the filter didn't work for me out of the box (because I was using it on a user's home directory), I was thinking about possible sources of error and those were the teo that came to mind. But I was unsure, since I know @TheBestPessimist has invested quite some thought into this.

In any case, I now think the first slash shouldn't be there.

As regards the MatchString method: I'm not a programmer, so if someone could explain if/how needs to be considered when composing filter rules?

@TheBestPessimist
Copy link
Owner

TheBestPessimist commented Feb 18, 2018

There's a much more detailed discussion in gilbertchen/duplicacy#355, you could want t look there.

From that discussion i might get to change a lot of the regexes (again :D).

@TheBestPessimist
Copy link
Owner

todo: check where it would make sense to remove the first slash as per @tophee's problem

TheBestPessimist pushed a commit that referenced this issue Nov 7, 2018
Include Slack notification option
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