Perl script to check for whether Remote files exist

How can I use perl to see whether or not a remote file exists or not?  
I need to check to see if a file is available on a unc path \\host\file1 and handle the exception if it is not accessible.

Thanks
TyBayAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Adam314Connect With a Mentor Commented:

if(-e "\\\\host\\file1") {
    print "file exists\n";
}
else {
    print "File does not exist\n";
}

Open in new window

0
 
agriesserCommented:
What platform are you running this script on? Windows or Linux?
0
 
TyBayAuthor Commented:
Windows
With Adam's pattern it does not seem to recognize that the file exists.  I can access via unc and then when using the provided pattern in Active State Perl on Windows I get a false negative every time.
0
 
TyBayAuthor Commented:
scratch that - syntax error on my part...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.