in reply to Re: Re: Re: Net::ftp - copy of file in cgi-bin
in thread Net::ftp - copy of file in cgi-bin

Yep, that's the bit I read - so can you shed some light on why it is writing the file to the cgi-bin? It is certainly going to right place on the external server and copying the correct file - but it is not duplicating it on the 'home' server. I'm a bit at a loss, I must admit...

Update: Whoops - I answered this and then saw your updates! I shall go and study them now. I appreciate your help!

  • Comment on Re: Re: Re: Re: Net::ftp - copy of file in cgi-bin

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Net::ftp - copy of file in cgi-bin
by nimdokk (Vicar) on Oct 28, 2003 at 18:38 UTC
    I'm going to hazard a guess that cgi-bin is where the script resides?

    If so, and if you are not specifying an absolute path to your final destination, you could be pulling the file into a default location, which is the directory where the script resides. Or in the case of a cron job, the users home directory. Now, you could do a chdir() prior to invoking Net::FTP and put your process into the destination directory. Or, you might be able to specify where you want the file in your "GET" statement. Since you are only involving two servers, there really does not seem to be a need to do two FTP's.

    You might try something like this:

    chdir("/local/destination/for/file") or die "Cannot chdir $!"; $ftp->get("myfile.txt","my_new_file.txt");
    or
    $ftp->get("/remote/path/to/file/myfile.txt","/local/path/to/file/myfil +e.txt");
    Does that help any? (I think I'm understanding what you are trying to do :)


    "Ex libris un peut de tout"
      Hi nimdokk, thanks for your input. I've had a play with your suggestions but nothing seems to have worked out yet. I'm going to leave it for now and get back to it tomorrow. I appreciate your help.
Re: Re: Re: Re: Re: Net::ftp - copy of file in cgi-bin
by ChrisR (Hermit) on Oct 28, 2003 at 18:34 UTC
    As far as the FTP object is concerned, there is no path to the file. When you execute the cwd, you set the relative path for the object. I found some interesting stuff in the docs and placed in my previous post.

    On another note: If you have moved the script to the backup server, you should only need one ftp instance and then one get statement per file. If the script is on the production machine, you still only need one ftp instance and one put statement per file.