GithubHelp home page GithubHelp logo

jasei / file-copy-recursive-verify Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 14 KB

Home Page: https://metacpan.org/pod/File::Copy::Recursive::Verify

License: Other

Perl 100.00%
verify copy perl perl5 module

file-copy-recursive-verify's Introduction

Build Status

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->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();

DESCRIPTION

Use 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 (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)

rcopy

alias of verify_rcopy

METHODS

new(%attributes)

%attributes

src_dir

source dir

src_hash

source HashRef of path -> hash

dst_dir

destination dir

dst_hash

destination HashRef of path -> hash

hash_algo

hash algorithm

default MD5

tries

number of tries

more about retry - 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 [email protected]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.