Perl fast file finder – File::Find::Rule

Hello again,

Here is a fine example of some Perl code to make finding files on your filesystem really, really fast :

use File::Find::Rule;
File::Find::Rule->file->exec(
    sub {
        print "Filename : " . $_[0], "\n";
        print "Path : " . $_[1], "\n";
        print "Path/Filename : " . $_[2], "\n";
        return 0;
    }
)->in('/path/to/manymanyfiles/');

See CPAN : File::Find::Rule to see how it works, in practice it’s the fastest way to traverse a directory and do stuff with the files found there (make thumbnails of images, for example).

That’s it, carry on!

CheersO,

~andy~

Leave a Reply

Your email address will not be published. Required fields are marked *