rcopy

Copying a directory and all it’s contents

You want to to copy a directory (and all the files and subdirectories in it),
from your Perl program.

You want functionality equivalent to the recursive copying performed by
the Unix “cp -R” command, but you don’t want to use a system() call to do
this.

File::NCopy

Use the File::NCopy module to recursively copy a directory and all it’s
contents.

Usage notes

If you’re familiar with the Unix copy command cp, you might be
excused for thinking that you could simply copy the existing source directory
to a brand new target directory as follows:

Instead you have to first create the target directory with the mkdir
function, and then supply the source argument with the trailing * wildcard,
in order to get the desired behaviour:

See also

Scroll to Top