summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/hashl26
1 files changed, 26 insertions, 0 deletions
diff --git a/bin/hashl b/bin/hashl
index b17e506..af070a9 100755
--- a/bin/hashl
+++ b/bin/hashl
@@ -130,6 +130,14 @@ sub file_in_db {
return hash_in_db(hash_file($file));
}
+sub db_find_new {
+ my ($file, $path) = @_;
+
+ if (not defined file_in_db($path)) {
+ say "\r\e[2K${file}";
+ }
+}
+
sub db_info {
printf(
"Read size: %d bytes (%.f KiB)\n",
@@ -249,6 +257,23 @@ sub cmd_copy {
print "\n";
}
+sub cmd_find_new {
+ my ($new_dir) = @_;
+
+ $new_dir //= $base;
+
+ prepare_db_run();
+
+ if (substr($new_dir, 0, 1) ne '/') {
+ $new_dir = $base . '/' . $new_dir;
+ }
+
+ $find_ref = \&db_find_new;
+ $find_db_write = 0;
+ find(\&process_file, $new_dir);
+ print "\n";
+}
+
sub cmd_ignore {
my ($ign_dir) = @_;
@@ -304,6 +329,7 @@ sub cmd_update {
given ($action) {
when ('copy') { cmd_copy(@ARGV) }
+ when ('find-new') { cmd_find_new(@ARGV) }
when ('ignore') { cmd_ignore(@ARGV) }
when ('info') { cmd_info(@ARGV) }
when ('list') { cmd_list(@ARGV) }