summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-06-13 09:25:27 +0200
committerDaniel Friesel <derf@finalrewind.org>2011-06-13 09:25:27 +0200
commit8a97f5cec2a22a5074154837ed4519ce70fcac69 (patch)
tree44fe8c9316bc0ee42640b665474150a8001e67b8 /bin
parent4c6a103f82fa7f3ad32ce66e3452c6e7b6f94c4b (diff)
Add "hashl list <regex>" to filter listed files by name
Diffstat (limited to 'bin')
-rwxr-xr-xbin/hashl12
1 files changed, 11 insertions, 1 deletions
diff --git a/bin/hashl b/bin/hashl
index f1e6cf8..85825bc 100755
--- a/bin/hashl
+++ b/bin/hashl
@@ -341,6 +341,8 @@ sub cmd_info {
}
sub cmd_list {
+ my ($re) = @_;
+
printf(
"# hashl v%s Read Size %d bytes (%s)\n",
$VERSION, $hashl->read_size(), $hashl->si_size( $hashl->read_size() ),
@@ -348,6 +350,11 @@ sub cmd_list {
for my $name ( sort $hashl->files() ) {
my $file = $hashl->file($name);
+
+ if ( $re and $name !~ m{$re} ) {
+ next;
+ }
+
printf( "%s %-7s %s\n",
$file->{hash}, $hashl->si_size( $file->{size} ), $name );
}
@@ -443,10 +450,13 @@ files for B<copy> or B<find-new>.
Show information on I<file> (or the database, if I<file> is not specified).
-=item B<list>
+=item B<list> [I<regex>]
List all files and their hashes. The list format is C<< hash size file >>.
+If I<regex> (a perl regular expression) is specifed, only matching files will
+be listed.
+
=item B<list-files>
List all filenames, one file per line.