Berimor66 / duplicati

Automatically exported from code.google.com/p/duplicati
0 stars 0 forks source link

Unable to get filters to work on command line with 1.2rc #427

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm trying to set up command-line Duplicati scripts so I can automate backups 
when not logged in.  I need to only backup certain files out of a directory, so 
I created include/exclude regexes.

In the gui, I was able to get this to work with the following filters:
+D:\\ForBackups\\SetA.*
-.*\..*
which is getting all files whose names start with SetA and excluding all 
others.  I had to put the full path in the include regex for some reason or it 
wouldn't work (i.e. SetA.* doesn't back up any files).

I can't get this to work at all with the command line version using include or 
include-regexp.  I've tried with and without full path, in brackets, etc.  It 
never backs up any files.  If I remove the include/exclude filters, it backs up 
all the files in the dir as expected.

Original issue reported on code.google.com by brian.da...@grapecity.com on 9 Jun 2011 at 7:20

GoogleCodeExporter commented 9 years ago
There are two different kinds of filters the --include and --exclude options 
work with "file globbing" filters (which are internally converted to regexp's). 
The --include-regexp and --exclude-regexp options work with regexp's directly.

Can you post me a sample commandline and a mockup of the directory structure?

For the full-path problem, could it be the same as issue #417:
http://code.google.com/p/duplicati/issues/detail?id=417

Original comment by kenneth@hexad.dk on 10 Jun 2011 at 8:01

GoogleCodeExporter commented 9 years ago
This was one of the attempts (I've tried a bunch of variants):
"C:\Program Files\Duplicati\Duplicati.CommandLine.exe" 
--include-regexp="SetA.*" --exclude-regexp="*" --no-encryption --full 
--volsize="512mb" --auto-cleanup "C:\Scripts" "ssh://sshinfo"

Directory has:
SetA1101.bak
SetA1102.bak
Unwanted1.bak
Unwanted2.bak
etc

What I'm wanting is for the regex SetA.* to get all files that start with SetA 
and the exclude to block the others.  

I am running with admin rights (Server 2008), so #417 may some relevance but my 
problem is that nothing is backed up where his was getting unwanted files.

Original comment by brian.da...@grapecity.com on 10 Jun 2011 at 8:15

GoogleCodeExporter commented 9 years ago
Ok, there are two issues that makes this fail.
First off, there is a parsing bug that makes Duplicati interpret the regexp's 
as globbing expressions, which explains why "*" does not report an error (it 
should be ".*").

Second there is a slightly strange convention that relative filenames are 
matched with a slash. My internal comments are:

All paths start with a slash, because this eases filter creation
Eg. filter "\Dir\" would only match folders with the name "Dir", where "Dir\" 
would also match "\MyDir\"
If the leading slash/backslash is missing, it becomes difficult to prevent 
partial matches.

I will fix the regexp/globbing problem asap. To get it working, you should be 
able to issue:

"C:\Program Files\Duplicati\Duplicati.CommandLine.exe" --include="\SetA*" 
--exclude="*" --no-encryption --full --volsize="512mb" --auto-cleanup 
"C:\Scripts" "ssh://sshinfo"

Original comment by kenneth@hexad.dk on 12 Jun 2011 at 8:59

GoogleCodeExporter commented 9 years ago
This issue was updated by revision r790.

Original comment by kenneth....@gmail.com on 12 Jun 2011 at 9:01

GoogleCodeExporter commented 9 years ago
Thanks, it works with the leading \ added.

Original comment by brian.da...@grapecity.com on 15 Jun 2011 at 2:45

GoogleCodeExporter commented 9 years ago
Nice.

FYI, 1.2 final has the regexp fix included if you want more advanced filters.

Original comment by kenneth@hexad.dk on 15 Jun 2011 at 4:34