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/") { }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Check Directories for Files
by almut (Canon) on Nov 24, 2009 at 19:40 UTC | |
Re: Check Directories for Files
by toolic (Bishop) on Nov 24, 2009 at 19:41 UTC | |
Re: Check Directories for Files
by halfcountplus (Hermit) on Nov 24, 2009 at 19:33 UTC | |
Re: Check Directories for Files
by Your Mother (Archbishop) on Nov 24, 2009 at 20:07 UTC | |
Re: Check Directories for Files
by baxy77bax (Deacon) on Nov 24, 2009 at 19:43 UTC | |
by toolic (Bishop) on Nov 24, 2009 at 20:03 UTC | |
Re: Check Directories for Files
by leocharre (Priest) on Nov 24, 2009 at 20:40 UTC | |
by drodinthe559 (Monk) on Nov 24, 2009 at 20:55 UTC |
Back to
Seekers of Perl Wisdom