This will work:
$somedir = "c:/windows"; if (-d $somedir) { print "$somedir exists"; } else { print "$somedir does not exist!"; }
If you have a look at perlman:perlfunc and find -X under the Functions for filehandles, files, or directories you will find a range of file tests that can be applied to files and dirs.
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: How to test if a directory exists?
by tachyon
in thread How to test if a directory exists?
by newbie00
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |