Ed Panni wrote: : I was wondering if there is a quicker way of getting a directory : listing from a disk. I am currently doing the following but it : takes a bit of time if I happen to have to search multiple 250Gb : drives.
You are searching through a lot of files. Perhaps the best way to speed things up is to change your algorithm. Instead of collecting all the files first, why not process each wanted file as it is found? You might also be able to break the task down into more manageable chunks of files. Perhaps 10 or 20 GB sections of the disks at a time. The File::Find module will help make this easier. : $i = c d e; No quoting? That doesn't look good. : @array = ""; Why set the first element to ""? Why name an array "array"? We already know it's an array. Why not use something like @files? : foreach $i (split/ /,$disk) { $disk has not been defined yet. Perhaps you meant $i? : print "\nChecking $i: for the tests....."; : @array1= `dir $i:\\ /B /S`; Perl has built-in directory functions. You might also find the File::Find module useful. It will recurse directories and allows you to filter for certain files. File::Find::Rule is very convenient, though still slow on an entire drive. : # Establish a count of how big the array is for stepping : through the array later to find the .exe file : : $lineC = @array1; $lineC will reset for each drive. That's not what you probably want. Everything in @array will be one big array when the loop is finished, not separate arrays for each drive. It sounds like you need a hash of arrays keyed to drive letters, not a simple array. : # append the array if more than one disk is selected : : push(@array, @array1); : : } Read the "perlfunc" file, especially directory functions. Start with "opendir" and follow the links to related functions. There's an example of reading a directory under the readdir function. The File::Find module is the most popular way to safely recurse directories. Read up on the use of strictures and warnings. You have a sloppy programming style which will hurt you down the road. Start every script with these modules. Think of them as training wheels. They are needed until you find your balance. use strict; use warnings; use diagnostics; Charles K. Clarkson -- Mobile Homes Specialist Free Market Advocate Web Programmer 254 968-8328 Don't tread on my bandwidth. Trim your posts. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>