File::Copy::Recursive::Verify - data-safe recursive copy
use File::Copy::Recursive::Verify qw(verify_rcopy);
verify_rcopy($dir_a, $dir_b);
#OOP equivalent
File::Copy::Recursive::Verify->new(
src_dir => $dir_a,
dst_dir => $dir_b,
)->copy();
#some complex copy - I know SHA-256 hash of subdir/a.dat file
#tree $dir_a:
#.
#├── c.dat
#└── subdir
# ├── a.dat
# └── b.dat
verify_rcopy($dir_a, $dir_b, {tries => 3, hash_algo => 'SHA-256', src_hash => {'subdir/a.dat' => '0'x64}});
#OOP equivalent
File::Copy::Recursive::Verify->new(
src_dir => $dir_a,
dst_dir => $dir_b,
tries => 3,
hash_algo => 'SHA-256',
src_hash => {'subdir/a.dat' => 0x64},
)->copy();
Use File::Copy::Verify for recursive copy.
functional api
Recusive copy of dir_a
to dir_b
.
Retry mechanism is via Try::Tiny::Retry (Each file will try verify_copy 10 times with exponential backoff in default).
As verification digest are use fastest MD5 in default.
$options
is HashRef of attributes.
return HashRef of copied files (key source, value destination)
alias of verify_rcopy
source dir
source HashRef of path -> hash
destination dir
destination HashRef of path -> hash
hash algorithm
default MD5
number of tries
more about retry - Try::Tiny::Retry
start recursive copy
return HashRef of copied files (key source, value destination)
Copyright (C) Avast Software.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Jan Seidl seidl@avast.com