+ if ( defined($conf->{BackupFilesOnly}{$t->{shareName}}) ) {
+ my(@inc, @exc, %incDone, %excDone);
+ foreach my $file ( @{$conf->{BackupFilesOnly}{$t->{shareName}}} ) {
+ #
+ # If the user wants to just include /home/craig, then
+ # we need to do create include/exclude pairs at
+ # each level:
+ # --include /home --exclude /*
+ # --include /home/craig --exclude /home/*
+ #
+ # It's more complex if the user wants to include multiple
+ # deep paths. For example, if they want /home/craig and
+ # /var/log, then we need this mouthfull:
+ # --include /home --include /var --exclude /*
+ # --include /home/craig --exclude /home/*
+ # --include /var/log --exclude /var/*
+ #
+ # To make this easier we do all the includes first and all
+ # of the excludes at the end (hopefully they commute).
+ #
+ $file = "/$file";
+ $file =~ s{//+}{/}g;
+ my $f = "";
+ while ( $file =~ m{^/([^/]*)(.*)} ) {
+ my $elt = $1;
+ $file = $2;
+ if ( $file eq "/" ) {
+ #
+ # preserve a tailing slash
+ #
+ $file = "";
+ $elt = "$elt/";
+ }
+ push(@exc, "$f/*") if ( !$excDone{"$f/*"} );
+ $excDone{"$f/*"} = 1;
+ $f = "$f/$elt";
+ push(@inc, $f) if ( !$incDone{$f} );
+ $incDone{$f} = 1;
+ }
+ }
+ foreach my $file ( @inc ) {
+ push(@fileList, "--include=$file");
+ }
+ foreach my $file ( @exc ) {
+ push(@fileList, "--exclude=$file");
+ }
+ }