NAME

File::Copy::Recursive - Perl extension for recursively copying files and directories

SYNOPSIS

use File::Copy::Recursive qw(fcopy rcopy dircopy);

fcopy($orig,$new[,$buf]) or die $!;
rcopy($orig,$new[,$buf]) or die $!;
dircopy($orig,$new[,$buf]) or die $!;

DESCRIPTION

This module copies directories recursively (or single files, well... singley) to an optional depth and attempts to preserve each file or directory's mode.

EXPORT

None by default. But you can export all the functions as in the example above.

fcopy()

This function uses File::Copy's copy() function to copy a file but not a directory. One difference to File::Copy::copy() is that fcopy attempts to preserve the mode (see Preserving Mode below) The optional $buf in the synopsis if the same as File::Copy::copy()'s 3rd argument

dircopy()

This function recursively traverses the $orig directory's structure and recursively copies it to the $new directory. $new is created if necessary. It attempts to preserve the mode (see Preserving Mode below) and by default it copies all the way down into the directory, (see Managing Depth) below. If a directory is not specified it croaks just like fcopy croaks if its not a file that is specified.

rcopy()

This function will allow you to specify a file *or* directory. It calls fcopy() if its a file and dircopy() if its a directory.

Preserving Mode

By default a quiet attempt is made to change the new file or directory to the mode of the old one. To turn this behavior off set $File::Copy::Recursive::KeepMode to false;

Managing Depth

You can set the maximum depth a directory structure is recursed by setting: $File::Copy::Recursive::MaxDepth to a whole number greater than 0.

SEE ALSO

L<File::Copy> L<File::Spec>

AUTHOR

Daniel Muey, http://drmuey.com/cpan_contact.pl

COPYRIGHT AND LICENSE

Copyright 2004 by Daniel Muey

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.