Check to see if c:\temp exists on local system - PERL / RegEx
What is wrong with my syntax:
if (-d =~ /c:\\[Tt][Ee][Mm][Pp]/i) {
print "There is a directory c:\\TEMP already..\n!";
}
else {
print "didn't find";
开发者_运维知识库}
Instead of checking for C:\Temp or one of its many variants, you should either use a perl module written for handling temp files or use the Win32 API to obtain the temp folder.
I think you need opendir(my $dh,'C:\temp\\' or die;if(-d $dh){...
.
Check out perldoc -f '-x'
I figured it out: if (-e "c:\temp") {
精彩评论