diff options
author | Florian Pritz <bluewind@xinu.at> | 2018-01-24 01:10:15 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2018-01-24 01:10:15 +0100 |
commit | d28bcb7e09769e6eaf9e4e9f0206fdc9e76a575a (patch) | |
tree | a5ea3f8bc80e94cec074f5f12107835e163db936 /lib/App/BorgRestore | |
parent | ff87476fe745ecafcafe779241469b5617831c27 (diff) | |
download | App-BorgRestore-d28bcb7e09769e6eaf9e4e9f0206fdc9e76a575a.tar.gz App-BorgRestore-d28bcb7e09769e6eaf9e4e9f0206fdc9e76a575a.tar.xz |
Add --list feature to search for files contained in backups by path
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib/App/BorgRestore')
-rw-r--r-- | lib/App/BorgRestore/DB.pm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/App/BorgRestore/DB.pm b/lib/App/BorgRestore/DB.pm index 3fddbf1..1f1427e 100644 --- a/lib/App/BorgRestore/DB.pm +++ b/lib/App/BorgRestore/DB.pm @@ -177,6 +177,22 @@ method verify_cache_fill_rate_ok() { } } +method search_path($pattern) { + $log->debugf("Preparing path search for pattern '%s'", $pattern); + my $st = $self->{dbh}->prepare('select path from files where path like ?'); + $log->debug("Executing search"); + $st->execute($pattern); + $log->debug("Fetching search result"); + + my @ret; + while (my $row = $st->fetchrow_hashref()) { + push @ret, $row->{path}; + } + + $log->debugf("Found %d matching paths", 0+@ret); + return \@ret; +} + method vacuum() { $self->{dbh}->do("vacuum"); } |