File::Mirror - Perl extension for recursive directory copy
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';
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
mirror
recursive
File::Mirror fills the gap between File::Copy::Recursive, which only focuses on file copying, and File::Find, which is too obstacal to use.
File::Copy::Recursive
File::Find
mirror $src, $dst
Recursive copy files from $src to $dst. Create new directory is necessary. Symbol links will not be followed.
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.
$_[0]
$_[1]
User need to distinguish directories, file, symbol links, and devices from $_[0].
Jianyuan Wu, <jwu@cpan.org>
Copyright 2007 by Jianyuan Wu
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install File::Mirror, copy and paste the appropriate command in to your terminal.
cpanm
cpanm File::Mirror
CPAN shell
perl -MCPAN -e shell install File::Mirror
For more information on module installation, please visit the detailed CPAN module installation guide.