in reply to Re: Read all the file path having text document
in thread Read all the file path having text document

Hi Monks, Thanks for the help . I completely changed my code and its working , though its taking 4 minutes to get the path of all the text documents. I have a 120 GB hardisk and only 40 GB contains text document. Can I make it faster?Navzit
use File::Find::Rule; my $rule = File::Find::Rule->new; $rule->file; $rule->name( '*.txt' ); my @files = $rule->in("/" ); open(W,"> index.txt")|| die "can't open index.txt file"; foreach $files_name (@files) { print W $files_name ; print W "\n"; }

Replies are listed 'Best First'.
Re^3: Read all the file path having text document
by dwhite20899 (Friar) on Dec 01, 2008 at 02:20 UTC
    Compare your code to the code produced by find2perl / -type f -iname '*\.txt'

    Depending on your computer and disk specs, 4 minutes may not be all that bad.