well you you could wind the dirs into an array and leave out the . and ..
my @dirs = grep (!/^\.\.?$/) readdir(DIR);

or you can just skip over as you go:
while ($file= readdir WDIR) {
        next if $file =~ /^\.\.?$/;     

> -----Original Message-----
> From: Maxim Berlin [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 05, 2001 3:58 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Parent and Current Directories
> 
> 
> Hello SAWMaster,
> 
> Thursday, July 05, 2001, SAWMaster <[EMAIL PROTECTED]> wrote:
> 
> S> Hello group!
> 
> S> I'm  trying to list all files in a directory EXCEPT the current and
> S> the parent directories.
> 
> S> ie.
> 
> S> .
> S> ..
> S> file1
> S> file2
> S> file3
> 
> S> Is not what I want.  I only want:
> 
> S> file1
> S> file2
> S> file3
> 
> S> I thought I had the right code, but I don't.
> 
> S> while($i < ($#filelist))
> S> {
> S>     if ((@filelist[$i] ne '.') || (@filelist[$i] ne '..'))
> 
> try $filelist[$i]
> 
> S>     {
> S>         print @filelist[$i];
> S>         print "<BR>\n";
> S>         $i++;
> S>     }
> S> }
> 
> S> I was thinking, maybe it's not equal to . and .. because 
> of a newline at the end of . and .. ?
> 
> S> But I tried a chop, or chomp and it just took off the last 
> letter of all files, problem unsolved.
> 
> S> Can someone steer a newbie in the right direction again?
> 
> Best wishes,
>  Maxim                            mailto:[EMAIL PROTECTED]
> 
> 
> 

Reply via email to