chetanspecial has asked for the wisdom of the Perl Monks concerning the following question:
1.The writefile function displays over 1000 files instead of over 30000@mainarray=("D:"); sub indexcurrent; indexcurrent("D:"); writefile(); sub indexcurrent { if(opendir(DIR,$_[0])) { local @current=readdir(DIR); for($i=0;$i<=$#current;$i++) { //this if is because the readdir function //returns "." and ".." also as folders if(($current[$i] ne "..")&&($current[$i] ne ".")) { $temp=$current[$i]; $current[$i]="$_[0]\\$temp"; \\Here i append the file name with current folder location push @mainarray,$current[$i]; indexcurrent($current[$i]); } } } } //to write the array of indexed files into a file sub writefile { open(File,">E:\\project\\index.txt"); print File join("\n",@mainarray); close (File); } print "complete"; <>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: File Indexing program
by psini (Deacon) on Jun 24, 2008 at 19:18 UTC | |
by chetanspecial (Initiate) on Jun 24, 2008 at 19:30 UTC | |
by psini (Deacon) on Jun 24, 2008 at 19:43 UTC | |
Re: File Indexing program
by pc88mxer (Vicar) on Jun 24, 2008 at 19:32 UTC | |
by jettero (Monsignor) on Jun 24, 2008 at 19:56 UTC | |
Re: File Indexing program
by moritz (Cardinal) on Jun 24, 2008 at 19:09 UTC | |
Re: File Indexing program
by starbolin (Hermit) on Jun 25, 2008 at 19:54 UTC |