<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">[![Build Status](https://travis-ci.org/JaSei/File-Copy-Recursive-Verify.svg?branch=master)](https://travis-ci.org/JaSei/File-Copy-Recursive-Verify)
# NAME

File::Copy::Recursive::Verify - data-safe recursive copy

# SYNOPSIS

    use File::Copy::Recursive::Verify qw(verify_rcopy);

    verify_rcopy($dir_a, $dir_b);

    #OOP equivalent

    File::Copy::Recursive::Verify-&gt;new(
        src_dir =&gt; $dir_a,
        dst_dir =&gt; $dir_b,
    )-&gt;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 =&gt; 3, hash_algo =&gt; 'SHA-256', src_hash =&gt; {'subdir/a.dat' =&gt; '0'x64}});

    #OOP equivalent

    File::Copy::Recursive::Verify-&gt;new(
        src_dir =&gt; $dir_a,
        dst_dir =&gt; $dir_b,
        tries   =&gt; 3,
        hash_algo =&gt; 'SHA-256',
        src_hash =&gt; {'subdir/a.dat' =&gt; 0x64},
    )-&gt;copy();

# DESCRIPTION

Use [File::Copy::Verify](https://metacpan.org/pod/File::Copy::Verify) for recursive copy.

# FUNCTIONS

## verify\_rcopy($src\_dir, $dst\_dir, $options)

functional api

Recusive copy of `dir_a` to `dir_b`.

Retry mechanism is via [Try::Tiny::Retry](https://metacpan.org/pod/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](#attributes).

return _HashRef_ of copied files (key source, value destination)

## rcopy

alias of `verify_rcopy`

# METHODS

## new(%attributes)

### %attributes

#### src\_dir

source dir

#### src\_hash

source _HashRef_ of path -&gt; hash

#### dst\_dir

destination dir

#### dst\_hash

destination _HashRef_ of path -&gt; hash

#### hash\_algo

hash algorithm

default _MD5_

#### tries

number of tries

more about retry - [Try::Tiny::Retry](https://metacpan.org/pod/Try::Tiny::Retry)

## copy;

start recursive copy 

return _HashRef_ of copied files (key source, value destination)

# LICENSE

Copyright (C) Avast Software.

This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

# AUTHOR

Jan Seidl &lt;seidl@avast.com&gt;
</pre></body></html>