diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/hashl | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -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) } |