Question.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,
I am a beginner perl developer.
I am writing a script for pasing all files in a directory with perticular suffix.
I use File::Find but I want to avoid searching in subdirectories. I tried to use File::Find::prune in "wanted" function. bit it did not work. So I use a heck
return unless ($File::Find::topdir eq $File::Find::dir); to avoid processing in sub directories. but this is an inefficient way. I want to limit search only to first directory level.
Please let me know the efficient way to do it. and any comments/modification on the code would also be appriciated.
Regards
Pankaj

sub wanted {
    ## dir tree Depth = 1
    return unless ($File::Find::topdir eq $File::Find::dir);
    $fileext= ".cgd";
    if ($_ =~ /$fileext$/) { # $_ contain file base name.
                             # $ sign at end of pattern looks for
                             # .lisa suffix

       $files[$Count] = "$File::Find::name";
       $Count++;
   }
}


[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Legacy Announce]     [Fedora PHP Devel]     [Kernel Devel]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Big List of Linux Books]     [Gimp]     [Yosemite Information]
  Powered by Linux