> -----Original Message-----
> From: Chas. Owens [mailto:[EMAIL PROTECTED] 
> Sent: Monday, February 11, 2008 13:21
> To: Michael Barnes
> Cc: beginners@perl.org
> Subject: Re: lstat and its uses
> 
> On Feb 11, 2008 4:17 PM, Michael Barnes <[EMAIL PROTECTED]> wrote:
> > I thought about using lstat to get the size of a file for file
> > comparisons.  I see that lstat always returns a list of 
> thirteen values.
> >  The references I find appear to require assignment of 
> those 13 values
> > to variables, even though I only want to use one.
> >
> > Do I really have to put
> >
> > ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
> >      $atime,$mtime,$ctime,$blksize,$blocks)
> >            = lstat($filename);
> >
> > Just to get the $size variable populated with the file size?
> >
> > My ultimate goal is to check the size of huge files copied 
> to a folder.
> >  Once I get the $size to come back the same three times in a row,
> > indicating the file is all there, then I can move on with 
> playing with
> > the file.
> snip
> 
> The lstat function returns a list, so you can use the splice 
> operator on it:
> 
> my $size = (lstat $filename)[7];
> 

If only after the size, then could use -s as part of the processing as:
my $size = -s $filename;
        if 0 then does not exist otherwise returns size of the file.

Wags ;) ps I would be weary of checking three times to see if the same
and saying it is done. I would either look at whether the file is open
and/or some type of trigger from a processs that the copy was done
successfully. A thought.

> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> http://learn.perl.org/
> 
> 
> 

**********************************************************************
This message contains information that is confidential and proprietary to FedEx 
Freight or its affiliates.  It is intended only for the recipient named and for 
the express  purpose(s) described therein.  Any other use is prohibited.
**********************************************************************


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to