in reply to error in copy folder recursively

Seems that File::Copy::Recursive is not installed? However, you instantiate a new object ($cp) of type File::NCopy. If that is intentional, you should use that module instead.

... # use File::Copy::Recursive; # not used in your example use File::NCopy; # this is the module you're trying to +use later ...

Replies are listed 'Best First'.
Re^2: error in copy folder recursively
by mrityunjaynath (Acolyte) on Jul 04, 2015 at 08:43 UTC

    hii Perlbotics
    i have tried your suggestion but the error prevails only replacing File/copy/recursive.pm to File/Ncopy.pm
    how to install File::Ncopy then

      Hello mrityunjaynath,

      No, stick with the File::Copy::Recursive module. File::NCopy is deprecated, according to its own documentation:

      File::NCopy - Deprecated module. Use File::Copy::Recursive instead.

      To learn how to install modules, see the Monastery’s Installing Modules tutorials. If you already have App::cpanminus installed, the process is as simple as entering:

      >cpanm File::Copy::Recursive

      from the command line.

      Another point: Where does $newpath come from? You need to declare and initialise it before it’s used:

      ... my $newpath = ...; # Provide an initial value here my $source_dirrtl = $newpath . "/rtl"; ...

      Hope that helps,

      Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

      I'm not sure you understand what people and perl are telling you. The perl error means that File::Copy::Recursive is not installed. The module documentation explains how to install it. Use the cpan method so that dependencies are also installed.

      Later in your code you have:

      my $cp = File::NCopy->new(recursive => 1);

      Your code does not have a use line for this module, like you do have for the other modules.

      I wouldn't recommend manually moving modules around unless you understand what you are doing. In addition I would suggest you take a step back and review the code you've posted.

        you may be right... i am new to perl ..
        as i said i have a source_folder containing some folders and files , i want to copy this folder and its subfolder and files to a target_directory. is there a way around for this thing....
        i am able to copy files but not subfolder