use this

#!/usr/bin/perl
#
#  This program takes args directory name and regexp to match
#  eg $0 "." "html$" gives all html files in current dir incl subdirectories
#
#
$ARGV[1] ||='.';
@files = getfiles($ARGV[0],$ARGV[1]);
print join("\n" , @files);

sub getfiles {
     my($dir,$regexp)=@_;
     opendir(DIR,$dir) || return ();
     my @ret;
     my @files =grep(!/^\.+$/,readdir(DIR));
     foreach $f(@files){
        if( -d "$dir/$f"){
            push @ret,getfiles("$dir/$f",$regexp);
        } else {
            eval('push(@ret ,"$dir/$f")  if($f=~/' . $regexp .'/)');
             warn $@ if($@ && $@!~/^Warning: something/);
        }
     }
     return @ret;
}


Phumes1 wrote:
> 
> Hi,
> 
> I want to add a simple search to my web page that will search all .asp
> pages from the root directory.
> 
> Does anyone know where I can get a nice one? I've seen a few but couldn't
> get them to work properly.
> 
> 
> 
> 
>+-----------------------------------------------------------------------------------+ 
> 
> [EMAIL PROTECTED]
> 
>+------------------------------------------------------------------------------------+
> 
> 
> 
> 



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

Reply via email to