File::Mirror - Perl extension for recursive directory copy


File-Mirror documentation  | view source Contained in the File-Mirror distribution.

Index


NAME

Top

File::Mirror - Perl extension for recursive directory copy

SYNOPSIS

Top

  use File::Mirror;

  # recurvie copy /path/A to /path/B

  mirror '/path/A', '/path/B';

  # or do things you like

  recursive { my ($from, $to) = @_; copy($from, $to) } '/path/A', '/path/B';

DESCRIPTION

Top

File::Mirror provides two helper functions to do recursive directory operations between source path and destination path. One is to call mirror which will do recursive copy. The other is to call recursive with a code block, which will be code for every file found in the source path.

File::Mirror fills the gap between File::Copy::Recursive, which only focuses on file copying, and File::Find, which is too obstacal to use.

EXPORT

mirror

  mirror $src, $dst

Recursive copy files from $src to $dst. Create new directory is necessary. Symbol links will not be followed.

recursive

  recursive {...} $src, $dst

Code block will be code with each file and sub-directories found in $src. Inside the code block, $_[0] will be set to source file name, $_[1] will be set to destination file name.

User need to distinguish directories, file, symbol links, and devices from $_[0].

AUTHOR

Top

Jianyuan Wu, <jwu@cpan.org>

COPYRIGHT AND LICENSE

Top


File-Mirror documentation  | view source Contained in the File-Mirror distribution.