Perl: the Markov chain saw | |
PerlMonks |
Search a directory for filesby gzayzay (Sexton) |
on Mar 09, 2006 at 20:20 UTC ( [id://535489]=perlquestion: print w/replies, xml ) | Need Help?? |
gzayzay has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I am trying to search a directory for two files I have created. If those files are found I will like to perform a particular task. However, If the files are not found, I will like to call a function that generates those files am searching for. My problem is, I am having difficulties searching the directory to see if the file exist. I have a "for" loop as follows:
I wiil like to search the entire folder first to see if my files are present. If not, then I will like the GenerateTestFileList() function to be called. What is currently happening with the above code, when every it searches the first file in the directory and it is not the file I am looking for, it calls the GenerateTestFileList() function. However, I want to search the entire directory and ensure that the files does not exit before calling the GenerateFileList() function. The Great monks kindly help me with this task? Thanks, Edman
Back to
Seekers of Perl Wisdom
|
|