Dion Almaer > File-Recurse > File::Recurse

Download:
File-Recurse-0.11.tar.gz

Dependencies

Annotate this POD (1)

CPAN RT

New  1
Open  0
View Bugs
Report a bug
Module Version: 0.11   Source  

NAME ^

File::Recurse.pm - Module for Recursing directories

DESCRIPTION ^

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.

SYNOPSIS ^

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', ... ];

RULES ^

 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

EXAMPLE ^

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"; } }

AUTHOR ^

Dion Almaer (dion@member.com)