How to copy a file in Perl and save its timestamp?

I use the File :: Copy module to copy a file in Perl:

#! /usr/bin/perl -w

use File::Copy;

copy("somefile.log", "copiedfile.log");

I would like to keep timestamps (especially modification time), but this does not seem to be an option.

Is there an easy way to achieve this without resorting to the "cp -p" system call?

+3
source share
2 answers

stat, utime, . , . - , cp -p. , File::Copy , unix . RT # 96158, - . , .

+4

:: . syscopy rmscopy. .

+4

Source: https://habr.com/ru/post/1721620/


All Articles