Feb 25, 2009

perl get remote file property and copy to local - for windows

perl to get remote file property is simple,but it spends me lots of time to findout windows driver syntax .

use strict;
use warnings;
use File::Copy;
my $remote_file = "\\\\192.168.1.1\\c\$\\temp.log";
my ($mtime) = (stat $remote_file)[9];
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($mtime);
$year+=1900;
$mon +=1;
print "$year/$mon/$mday $hour:$min:$sec";
copy($remote_file, "C:\\Temp");

0 意見: