开发者

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") {

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜