Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How do I check if a file exist on a remote server in PERL?

Posted on 2004-10-15
2
Medium Priority
?
1,913 Views
Last Modified: 2013-12-25
How do I check if a file exist on a remote server?

I use this to check if a file exist on the local machine

$filename= "products/images/file.txt";
if(-e $image_url){
  # do something
}

is there a similar way of doing it or...
0
Comment
Question by:slobstar
[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 Comments
 
LVL 48

Accepted Solution

by:
Tintin earned 1600 total points
ID: 12322843
First you have to answer what protocol, ie:  HTTP, HTTPS, SSH, FTP, SOAP etc.

I'll take a guess at HTTP, in which case, do

use LWP::Simple;
head("http://www.example.com/some/file.txt") or die "file.txt does not exist on remote server\n";
 


0
 
LVL 5

Assisted Solution

by:ITcrow
ITcrow earned 400 total points
ID: 12330528
Use File::Remote

Module documentation have plenty of functional examples:
http://search.cpan.org/~nwiger/File-Remote-1.16/Remote.pm
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

618 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