?
Solved

Perl script to check for whether Remote files exist

Posted on 2008-06-24
4
Medium Priority
?
1,288 Views
Last Modified: 2008-06-24
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
0
Comment
Question by:TyBay
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 39

Accepted Solution

by:
Adam314 earned 2000 total points
ID: 21860156

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

Open in new window

0
 
LVL 14

Expert Comment

by:agriesser
ID: 21860184
What platform are you running this script on? Windows or Linux?
0
 

Author Comment

by:TyBay
ID: 21861567
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
 

Author Comment

by:TyBay
ID: 21861614
scratch that - syntax error on my part...
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question