File::Xcopy is a Perl module that can copy files after comparing them.
my $fx = new File::Xcopy;
$fx->fn_pat('(.pl|.txt)$'); # files with pl & txt extensions
$fx->param('s',1); # search recursively to sub dirs
$fx->param('verbose',1); # search recursively to sub dirs
my ($sr, $rr) = $fx->get_stat;
$fx->xcopy; # or
# the same with short name
$fx->xcp("from_dir", "to_dir", "file_name_pattern");
The File::Xcopy module provides two basic functions, xcopy and xmove, which are useful for coping and/or moving a file or files in a directory from one place to another. It mimics some of behaviours of xcopy in DOS but with more functions and options.
The differences between xcopy and copy are:
· xcopy searches files based on file name pattern if the pattern is specified.
· xcopy compares the timestamp and size of a file before it copies.
· xcopy takes different actions if you tell it to.
The Constructor new(%arg)
Without any input, i.e., new(), the constructor generates an empty object with default values for its parameters.
If any argument is provided, the constructor expects them in the name and value pairs, i.e., in a hash array.
What's New in This Release: [ read full changelog ]
· fixed a bug in the execute method.
· added syscopy method to replace methods in File::Copy module. The copy method in File::Copy does not reserve the attributes of a file.
· tested on Solaris and Win32 operating systems