Skip to main content

在Perl中用File::Copy来移动和拷贝文件

技术
Author

cookwhy

Published

August 7, 2008

在Perl中如果需要写有关文件移动或是拷贝的命令,可以使用kurila-1.11_0下面的File::Copy模块来实现这个功能。

使用起来相当的简单与灵活:

use File::Copy;

copy(“file1″,”file2”) or die “Copy failed: $!”;
copy(“Copy.pm”,*STDOUT);
move(“/dev1/fileA”,”/dev2/fileB”);

use File::Copy “cp”;

\(n = FileHandle->new(“/a/file”,”r”); cp(\)n,”x”);