> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 11, 2002 11:58 AM
> To: [EMAIL PROTECTED]
> Subject: Help with File::Find
> 
> 
> Hi Everyone!
> 
> I'm fairly new to Perl, and completely new to submitting to 
> the list, so
> please be easy on me.  :-)
> 
> The purpose of the code I wrote (listed below) is to go 
> through the current
> directory and all of its subdirectories and report the 
> filename, size and
> age of the x largest files, where x depends on the argument 
> supplied on the
> command line and the number of files in the directory.  I'm 
> sure there's an
> easier way to do this with a UNIX utility (or with Perl), but 
> this program
> has been a good learning experience for me.
> 
> The code below runs without any syntax errors, but File::Find 
> (which I love
> and use frequently) or the -e file test doesn't give the 
> results I expect.
> Specifically, my (explicit) checks show that the test in line 
> 11 does not
> always evaluate to TRUE for values of $_ corresponding to 
> legitimate (i.e.,
> existing and size > 0) files, which means I'm missing files 
> that should be
> in my final output.  If I change line 11for debugging 
> purposes to simply
> 
> if ($_){
> 
> all files (including the previously missed ones) are printed out (also
> along with the directories now) as expected, but for the 
> files that would
> not have passed the (-e $_) test, the values assigned for 
> filesize and age
> in line 12 are (tested to be) undefined.  If this is any 
> help, the files
> that don't pass the (-e $_) of test of line 11 are (perhaps 
> coincidentally)
> the biggest files (~55 GB)  in the directory.

I don't really have an answer, but conceptually, why would you need
a -e test at all? If the file doesn't exist, how would wanted() get
called for it?

Also, have you tried doing the -e on $File::Find::name instead of $_ ?
Perhaps there's some problem in changing directories.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to