App-Hashl

 view release on metacpan or  search on metacpan

bin/hashl  view on Meta::CPAN

Use I<dbfile> instead of F<.hashl.db>

=item B<-e>|B<--extra-db> I<dbfile>

Use I<dbfile> in addition to F<.hashl.db> / B<-d>. May be specified
several times.

Database files specified with this option will be opened read-only and ignored
by writing actions (such as B<update> or B<ignore>).

=item B<-f>|B<--force>

For use with C<< hashl add >>: If there are ignored files in the directory,
unignore and add them.

=item B<-n>|B<--no-progress>

Do not show progress information.  Most useful with C<< hashl find-new >>.

=item B<-s>|B<--read-size> I<kibibytes>

Change size of the part of each file which is hashed.  By default, B<hashl>
hashes the first 4 MiB.  Note that this option only makes sense when using C<<
hashl update >> to create a new database.

A size of 0 (zero) makes hashl read whole files, i.e. turning it into sha1sum
with a database.

=item B<-V>|B<--version>

Print version information.

=item B<-x>|B<--one-file-system>

Do not cross filesystem boundaries when processing files. At the time of this
writing, this may not prevent hashl from recursing into other filesystems,
but they will never be hashed, copied or otherwise processed.

=back

=head1 EXIT STATUS

Unless an error occured, B<hashl> will always return zero.

=head1 CONFIGURATION

None, so far

=head1 DEPENDENCIES

=over

=item * Digest::SHA

=item * List::MoreUtils

=item * Time::Progress

=back

=head1 BUGS AND LIMITATIONS

Unknown.

=head1 EXAMPLES

=head2 LEECHING

First, create a database of your local files:

C<< cd /media/videos; hashl update >>

Now, assume you have a (possibly slow) external share mounted at
F</tmp/mnt/ext>.  You do not want to copy all files to your disk and then use
B<fdupes> or similar to weed out the duplicates.  Since you just used B<hashl>
to create a database with the hashes of the first 4MB of all your files, you
can now use it to check if you (very probably) already have any remote file.
For that, you only need to leech the first 4MB of every file on the share, and
not the whole file.  For example:

C<< cd /tmp/mnt/ext; hashl copy /media/videos/incoming >>

=head2 EXTERNAL HARD DISK

Personally, I have all my videos on an external hard disk, which I usually do
not carry with me.  So, when I get new videos, I put them into F<~/lib/videos>
on my netbook, and then later copy them to the external disk.  Of course, it
can always happen that I get a movie I already have, or forget to move
something from F<~/lib/videos> to the external disk, especially since I also
always have some stuff from the disk in F<~/lib/videos>.

However, I can use B<hashl> to conveniently solve this issue.  Run
periodically:

C<< cd /media/argon; hashl -d ~/lib/video/.argon update >>

Now, I always have a list of files on the external disk with me.  When I get a
new file:

C<< hashl -d ~/lib/video/.argon new-file $file >>

And to find out which files are not on the external disk:

C<< cd ~/lib/video; print -l **/*(.) | hashl -d .argon new-file >>

=head1 AUTHOR

Copyright (C) 2010-2017 by Daniel Friesel E<lt>derf@finalrewind.orgE<gt>

=head1 LICENSE

  0. You just DO WHAT THE FUCK YOU WANT TO.



( run in 2.068 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )