Thanks Charles.
The copy parts works great. However, I still can't get any information on
the file. No values are being returned. I did the following:
use File::stat;
($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime,
$ctime, $blksize, $blocks)=stat("Perfect.xls");
print "$atime";
print "$mtime";
Kind regards
Dayo
-----Original Message-----
From: Charles K. Clarkson [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 14, 2005 6:28 PM
To: 'Perl Beginners - CGI List'
Subject: RE: Backing Up Files to a Remote Server
Adedayo Adeyeye <mailto:[EMAIL PROTECTED]> wrote:
: Thanks.
:
: To get the statistics of a file on my windows box, I ran the
: following script:
:
:
: open FILE1, "Perfect.xls" or die "Cannot open file: $!";
:
: my @stuff = stat "FILE1";
:
: print "@stuff";
:
: Unfortunately, I don't know why this never returned any values into
: my @stuff variable.
Because stat() works on filenames, not file handles.
my @stuff = stat 'Perfect.xls';
: Next I tried this:
:
: open FILE1, "Perfect.xls" or die "Cannot open file: $!";
:
: open FILE2, ">folder\Perfect.xls" or die "Cannot write to destination
: directory: $!";
In perl, directories are separated by "/" not "\". "\P" is an
escaped "P".
: system ("copy FILE1 FILE2");
:
: close FILE1;
: close FILE2;
use File::Copy 'copy';
copy( 'Perfect.xls', 'folder/Perfect.xls') or die "Copy failed: $!";
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>