| File-Mirror documentation | view source | Contained in the File-Mirror distribution. |
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 fills the gap between File::Copy::Recursive, which
only focuses on file copying, and File::Find, which is too obstacal
to use.
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].
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.
| File-Mirror documentation | view source | Contained in the File-Mirror distribution. |