kumar has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re: download using wget command
by pfaut (Priest) on Feb 18, 2003 at 18:19 UTC

    I appologize in advance for being a bit blunt but that's just my nature I guess. That said...

    This is a perl site. Just because you are trying to execute a command from a perl script by passing the command line to the system() function doesn't necessarily make it perl related. If you were trying to retrieve web pages using the LWP series of modules, that would be perl related and worthy of a post here.

    If you want to download files from the web using wget, my suggestion is to start with man wget or at least wget --help. Otherwise, post the rest of your script so that we can see how this is related to perl.

    Please spend a few minutes looking at Guide to the Monastery and Perl Monks Site FAQ. Follow some of the links you find there until you feel a bit more comfortable with what might be proper subject matter here.

    --- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';
Re: download using wget command
by valdez (Monsignor) on Feb 18, 2003 at 18:21 UTC

    Maybe your problem is that you are using backticks to execute wget. You need only system or backticks. If you need to save something in a different directory you should use the -P option of wget:

    system 'wget -P /usr/tmp http://192.168.0.1/abc'

    If you want to use only Perl, then look at LWP::Simple; a simple example:

    use LWP::Simple; mirror('http://192.168.0.1/abc', '/usr/tmp/abc');

    Ciao, Valerio

      valdez, I tried system 'wget -P /usr/tmp http://192.168.0.1/abc' command. But it's not working properly. I would like to download all files under abc folder to tmp folder. If i use system 'wget -P /usr/tmp http://192.168.0.1' then index.html is downloaded to tmp folder. Is it happend due to permission problem etc? Anyway thanks for your help.

        It's not a permissions problem, you didn't ask it to download any files, so it didn't. And this still isn't a perl question.

Re: download using wget command
by steves (Curate) on Feb 18, 2003 at 18:26 UTC

    That /usr/tmp argument isn't right. You'd need a -O argument to put the results to a temporary file and that would have to be a file name, not a directory. A full set of docs is here

Re: download using wget command
by Hagbone (Monk) on Feb 18, 2003 at 23:07 UTC
    I am but a struggling acolyte, and profess no expertise .... the code below is glommed from a script I currently use (and apparently works) ... hope it helps
    my $wget_file = '/path/to/file/that/contains/retrieved/data'; my $wget_url = 'http://www.wherever.com/directory/retriev_file.html'; my $wget_path = '/path/to/wget'; my $output = system("$wget_path -O $wget_file $wget_url");
Re: download using wget command
by Coruscate (Sexton) on Feb 18, 2003 at 23:14 UTC

    Just to add on to pfaut's comments, the messages boards are the wrong place to ask such questions, as yopu will not receive a positive response from everybody. I'll tell you right now that we *will* help you with such questions, as you've already been shown. I will make one recommendation: for simple questions (especially related as to how to run a command-line program), first look at the man page or try appending '--help' or '-?' to the program name to see the help. If you can't figure it out from there, I suggest posting to the chatterbox nodelet instead. Simple questions like these are always answered honestly and promptly, and it will not irritate many people at all.


    If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, reply to this node or /msg me to tell me what is wrong with the post, so that I may update the node to the best of my ability. If you do not inform me as to why the post deserved a downvote, your vote does not have any significance and will be disregarded.