Connecting Tech Pros Worldwide Help | Site Map

Check to see if file exsists (perl running on vista)

Member
 
Join Date: Nov 2008
Posts: 61
#1: Mar 10 '09
Hey I'm trying to see if a file exsists but I'm using windows, I know in Linux you can use -e but that doesn't seem to work for me in windows.

Expand|Select|Wrap|Line Numbers
  1.     if (-e $filename)
  2.     {
  3.         print "File Doesn't Exist!";
  4.     }     
  5.  
KevinADC's Avatar
Expert
 
Join Date: Jan 2007
Location: Southern California USA
Posts: 4,091
#2: Mar 10 '09

re: Check to see if file exsists (perl running on vista)


Your example is logically reversed, it should be:

Expand|Select|Wrap|Line Numbers
  1.  
  2.     if (-e $filename)
  3.     {
  4.         print "File Exists!";
  5.     }     
  6.  

-e works on Windows.
Reply