NAME
Directory::Diff::Copy - Copy differences between two directories
SYNOPSIS
use Directory::Diff::Copy 'copy_diff_only';
copy_diff_only ($old_dir, $new_dir, $output_dir);
FUNCTIONS
copy_diff_only
copy_diff_only ($old_dir, $new_dir, $output_dir);
Given directories specified by $old_dir
, $new_dir
, and $output_dir
, this compares the files in $old_dir
and $new_dir
using "directory_diff" in Directory::Diff, and puts the differing files only from $new_dir
into $output_dir
using "copy" in File::Copy. If $output_dir
does not exist, this creates it. If $output_dir
does exist, this removes all files from it using "rmtree" in File::Path before copying. New directories are made using "mkpath" in File::Path.
The return value is the number of files copied. This value is useful to detect whether anything was actually copied or not.
if (copy_diff_only ($o, $n, $t)) {
# we have actually copied things, so do something
} else {
# nothing copied, don't need to do any more work
}
An optional fourth parameter switches on debugging information if set to any true value:
copy_diff_only ($old_dir, $new_dir, $output_dir, 1);
The debugging information is printed to standard output. It specifies each file that has been copied.
SEE ALSO
Directory::Diff::Copy is part of the Directory::Diff distribution. See the documentation of Directory::Diff for full details of author, copyright, licence and version.