recursion - How can I copy an entire directory in Perl, without using File::Copy::Recursive? -
question:
my question pretty identical this 1 here except cannot use file::copy::recursive.
constraints:
i cannot install or modify existing environment, stuck using works.
use file::copy; # works! use file::copy::recursive # doesn't work :( use file::path # works!
i error: (i cannot fix error, since user of system, not admin or anything)
can't locate file/copy/recursive.pm in @inc (@inc contains: /path/to/some/place /path/to/other/place .) @ my_program.pl line 13.
scenario:
if helps, scenario want copy contents directory, lets ~/my_dir
onto exists here ~/
. ~/my_dir
has sub-folder ~/my_dir/sub_dir
, want copy directory , of it's contents too.
the system's tools way better @ anyway.
system('cp', '-rp', '--', $src, $dst); die("can't launch cp: $!\n") if $? == -1; die("cp killed signal ".($? & 0x7f)."\n") if $? & 0x7f; die("cp exited error ".($? >> 8)."\n") if $? >> 8;
the downside lack of portability. if want portability, install file::copy::recursive. if can install script on machine, can install file::copy::recursive.
Comments
Post a Comment