Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old December 24th, 2006, 09:25 PM
kk
Guest
 
Posts: n/a
Default help: downloading online files with perl

Hi,
I am trying to write a script that downloads a file from a website everyday.
Can I just use the copy command (i.e. use File::Copy)? Does it support URI?
I wrote something like below, but it does not seem to work.

use File::Copy;
copy(www.abc.com\abc.pdf, "C:\myfolder\") or die "File cannot be copied.";

Is there a better way to do this?

Sorry, it seems like a very easy thing to do, but I am doing something
wrong...

Thank you


  #2  
Old December 25th, 2006, 04:05 AM
Jürgen Exner
Guest
 
Posts: n/a
Default Re: downloading online files with perl

kk wrote:
Quote:
I am trying to write a script that downloads a file from a website
everyday.
Your Question is Asked Frequently:
"How do I fetch an HTML file?"
Quote:
Can I just use the copy command (i.e. use File::Copy)?
No.
Quote:
Does it support URI?
Well, of course not. A URI can be anything, not just a simple file.
Quote:
I wrote something like below, but it does not seem to
work.
use File::Copy;
copy(www.abc.com\abc.pdf, "C:\myfolder\") or die "File cannot be
copied.";
Is there a better way to do this?
Yes. As explained in the FAQ.

jue


  #3  
Old January 10th, 2007, 01:15 AM
Verizon
Guest
 
Posts: n/a
Default Re: downloading online files with perl


"kk" <abc@abc.comwrote in message
news:458eef17$0$8961$4c368faf@roadrunner.com...
Quote:
Hi,
I am trying to write a script that downloads a file from a website
everyday. Can I just use the copy command (i.e. use File::Copy)? Does it
support URI? I wrote something like below, but it does not seem to work.
>
use File::Copy;
copy(www.abc.com\abc.pdf, "C:\myfolder\") or die "File cannot be copied.";
>
Is there a better way to do this?
>
Sorry, it seems like a very easy thing to do, but I am doing something
wrong...
>
Thank you
>
Have a look at LWP (lib-www-perl). You'll probably need to do an HTTP
request, but it supports ftp, gopher and local file systems using this
module. I haven't tried this with what you're trying to do so I don't have
any examples, but I have used LWP to retrieve HTTP pages.

Craig


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles