in reply to Re^2: ftping a file from a remote server to another remote server
in thread ftping a file from a remote server to another remote server

You should put <code> </code> tags around your code so that formatting (like line breaks) is preserved.

Your approach is faulty:
$newftp->put($ftp->get("/export/home/xx/debugtrans.pl"))
You can't do a "put" of a "get". Two steps are required. You need to connect to B, download (get) the file onto machine A (your machine). Then connect to C and upload (put) the file.

Start with one step at a time. First get the download of the file from machine B to machine A working. Then try connecting and uploading to C.

Read the documentation carefully about "where" the file will go..

Replies are listed 'Best First'.
Re^4: ftping a file from a remote server to another remote server
by shivamem (Initiate) on Jul 20, 2011 at 08:41 UTC
    Hi Marshall, Thanks for your reply, Actual my requirement is there are 3 servers(A,B,C). A->B there is a network for ftping the file B->C there is a network for ftping the file A->C there is no network or firewall enabled So, A script should run on A server and ftp the file to B remote server and then the same script should run by logging into B server need to ftp the file to C which was done ftp onto B, server since there is no routing from A->C. the flow should be The script should be running only on A server A->B->C Please help me on the above query Regards, Shiva Krishna
      Your spec that the "script should run on A server and ftp the file to B remote server and then the same script (emphasis supplied) should run by logging into B server" -- taken litterally -- can NOT be achieved by any legitmate means of which I'm aware.

      yes, "logging into B server" is something the script on the A server can do... but it can NOT execute itself on the B server (except by injecting instructions to the CPU(s) there to use its own code, streamed to B after the injection - a malware technique).

      Rephrasing, for emphasis:

      1. If the code on A can't move itself to B and execute there, and if there's no route between A and C, your transfer scheme is not feasible.
      2. If you overcome those difficulties, your scheme is unsafe or unwise.
      Hi Shiva,
      Oh, I see now. My mistake in reading the requirements!
      I take this "same script should run by logging into B server" to mean that you do have some sort of log-in to the B server? That you have a user account?

      If you do have a shell account on B, then I would do things a bit differently. Walking through the process as a person... Imagine that you are at another computer D. You use D to manually log-in to B. So you are now at the command prompt on the B machine. Then you issue the shell commands that cause B to get the file from A. Then you issue the commands to cause B to put the file to C. Well, if a person can do this, then a Perl program can do it too! You do not need independent machine D, this can be just A. In other words, you write a program that simulates a human doing these manual steps and run that program on A. This requires a login to B. Would that scenario work?

      There are other ways if you can run a Perl program on B that "helps out" the program that you run on A. I just want to verify that it is not allowed to have any code at all running on B?

      Update: The bottom line question: Do you have any way at all of causing this file to be moved as described without a Perl program? We can automate what is already possible. We cannot make possible what is simply impossible.