I put in some prints to better see what's happening.  Here's the code and the results:
 
   foreach $xFile (@xFileList) {
      $x = "$local_dir\\$xFile";
      $xsize = (stat($x))[7];
      print "\nFile tested is $x; size was $xsize.\n";
      if ($xsize > 0) {
         print "   WILL process file $xFile (size=$xsize) ...\n";
      } else {
         print "   Will NOT process file $xFile (size=$xsize) ...\n";
      };
   };
 
Results:
   Will NOT process file bj_so_0083140631.xfr (size=) ...
...
 
Same output for every file in the directory (16 of them), even though 5 of the files are not empty.
 
Laurie
 
-----Original Message-----
From: Dirk Bremer (NISC) [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 06, 2004 2:31 PM
To: Laurie Vien; [EMAIL PROTECTED]
Subject: Re: Help getting file size (sheesh) ...

Laurie,
 
I suspect that you are not using a fully qualified filename. The filename should include the full path to the file.

Dirk Bremer - Systems Programmer II - ESS/AMS  - NISC St. Peters
USA Central Time Zone
636-922-9158 ext. 8652 fax 636-447-4471
 
----- Original Message -----
Sent: Wednesday, October 06, 2004 13:18
Subject: Help getting file size (sheesh) ...

 I'm trying to just determine the size of a file before I decide whether to process it.  In the following code,   $size always comes out null:
 
   foreach $xFile (@xFileList) {
      $size = (stat ($xFile))[7];
      if ($size gt 0) {
         print "   Found file $xFile with size $size, so WILL push it ...\n";
      } else {
         print "   Found file $xFile with size $size, so will NOT push it ...\n";
      };
 
 I also tried  $size = (-s _) instead of using "stat", but got the same result--$size comes out null.  What am I doing wrong? 
 
Thanks--
 Laurie
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to