How to copy the file ( Perl )


How to copy a file in Perl is as follows:
It worked well a copy command in a Windows environment for not behaving as expected despite the Linux, leave a note.

  1. File existence check
  2. to open
  3. close
  4. to copy

A specific code is as follows:

if(-e $temporaryFile){
    #file exists
} else {
    #file does not exists
    open(TMPFILE,">$temporaryFile") or die $!;
    close(TMPFILE);
}
copy($actualFile, $temporaryFile);

タグ:Perl


HOME2011年の記事ファイルをコピーする方法(Perl)

HOMEHOME CategoryCategory HistoryHistory

Site Search :

[HTML link code]