Index: lib/Brackup/Root.pm =================================================================== --- lib/Brackup/Root.pm (revision 194) +++ lib/Brackup/Root.pm (working copy) @@ -21,6 +21,7 @@ $self->{gpg_rcpt} = $conf->value('gpg_recipient'); $self->{chunk_size} = $conf->byte_value('chunk_size'); $self->{ignore} = []; + $self->{accept} = []; $self->{smart_mp3_chunking} = $conf->bool_value('smart_mp3_chunking'); @@ -84,6 +85,11 @@ push @{ $self->{ignore} }, $pattern; } +sub accept { + my ($self, $pattern) = @_; + push @{ $self->{accept} }, $pattern; +} + sub path { return $_[0]{dir}; } @@ -131,6 +137,26 @@ next DENTRY if $is_dir && "$path/" =~ /$pattern/; } + + if( @{ $self->{accept} } ) { + + foreach my $pattern (@{ $self->{accept} }) { + if( $path =~ /$pattern/ ) { + $statcache{$path} = $statobj; + push @good_dentries, $dentry; + next DENTRY; + } + + if( $is_dir && "$path/" =~ /$pattern/ ) { + $statcache{$path} = $statobj; + push @good_dentries, $dentry; + next DENTRY; + } + } + + next DENTRY; + } + $statcache{$path} = $statobj; push @good_dentries, $dentry; }