http://www.perlmonks.org?node_id=809171

drodinthe559 has asked for the wisdom of the Perl Monks concerning the following question:

Monks: I need to check each of the below directories for any files. If there is a file, I need to move it to a temp directory. I would like to know if there is a more efficient way to check each directory. I'm thinking a loop of some sort, but there is a gap of numbers.
#!/usr/bin/perl -w use strict; use warnings; use File::Copy; if (-e "D:/DOWNLOAD/DISTRBTN/I01/B01/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B02/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B03/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B04/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B05/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B06/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B07/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B08/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B09/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B10/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B11/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B12/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B13/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B14/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B15/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B16/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B17/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B18/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B19/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B20/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B21/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B22/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B50/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B60/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B70/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B80/") { } if (-e "D:/DOWNLOAD/DISTRBTN/I01/B97/") { }