I'm trying to check a directory for the existence of a specific file using pattern matching. If the file is there, it matches and executes the "Block" normally. However, if there is no file there, it should do something else.....instead it does nothing, I guess because there's no file to attempt to match the pattern to. Should I use 2 seperate if conditionals? 1. if a file is there & it matches do this, and then a seperate if conditional...if there are no files do this....I would surely like to do it with one if-else conditional.
opendir(DULS, 'D:\COLD\DULS');
chdir 'D:\COLD\DULS';
@files = glob ('cold*');
foreach $file (@files)
{
print CBDOWNLOAD "Cold Backup file exists for DULS for $FileName.\n" i
+f ($file =~ m/^cold/);
system ('awtrap -h RLGH -f DULS "DULSVASG001: Unable to download the
+file."') if ($file !~ m/^cold/);
}
Please drop some knowledge on a brotha....!!!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.