NAME - Module for Recursing directories


This module is used to recurse directory structures and saving the data into a hash of array references. You can give it certain rules (e.g. '.gif' will match only *.gif files) and you can make it check for a '.ignore_index' file in that directory to make it ignore.


o %hash = Recurse(\@dirs, \%rules)

  Go through the @dirs and apply any rules from %rules. It will return
  a %hash where the keys are directories, and the values are the files
  in that directory in an array.

  e.g. $hash{'/usr/local/bin'} = [ 'ls', 'irc', ... ];


 In the rules hash you can have

 match => regex file pattern,    [e.g. match => '\.gif']
 nomatch => regex file pattern,  [e.g. nomatch => 's\.txt']
 ignore => 1|0                   [e.g. ignore => 1]

 note: if you send '.gif' that will look for any token next to gif and
       '\.gif' is probably what you are looking for


Here is an example program that would output all the files in directories starting from /tmp that have a period somewhere in the name, and isn't a .gif file

use File::Recurse;

my %files = Recurse(['/tmp'], {match => '\.', nomatch => '\.html$'});

foreach (sort keys %files) { print "Dir: $_\n"; foreach (@{ $files{$_} }) { print " File: $_\n"; } }


Dion Almaer (