FTP copy a file to another place in same FTP

ftp commands to transfer files
ftp move multiple files to another directory
how to transfer files using ftp in windows
mput command in unix
ftp put directory
how to transfer file from one server to another using ftp in java
ftp copy directory
upload file to ftp server using command line linux

I need to upload same file to 2 different place in same FTP. Is there a way to copy the file on the FTP to the other place instead of upload it again? Thanks.

I don't think there's a way to copy files without downloading and re-uploading, at least I found nothing like this in the List of FTP commands and no client I have seen so far supported something like this.

FTP copy a file to another place in same FTP, Ensure that you have write permission to the target directory. There's no standard way to duplicate a remote file over the FTP protocol. Some FTP servers support proprietary or non-standard extensions for this though. Some FTP clients do support the remote file duplication. Either using the extensions or via a temporary local copy of the remote file.

move/copy file using an ftp server, There's no standard way to duplicate a remote file over the FTP protocol. Some FTP servers support proprietary or non-standard extensions for this though. Some FTP clients do support the remote file duplication. Either using the extensions or via a temporary local copy of the remote file. The FTP Task only seems to allow sending and receiving between a local path and an FTP path, and deletion of files on the FTP Server, but not copying when both locations are on the FTP Server.

Yes, the FTP protocol itself can support this in theory. The FTP RFC 959 discusses this in section 5.2 (see the paragraph starting with "When data is to be transferred between two servers, A and B..."). However, I don't know of any client that offers this sort of dual server control operation.

Note that this method could transfer the file from the FTP server to itself using its own network, which won't be as fast as a local file copy but would almost certainly be faster than downloading and then reuploading the file.

Copying Files from an FTP Server to another directory on the same , Is it possible (and how) to copy a file on a remote machine to a different place on the same remote machine using FTP? share. The FTP (File Transfer Protocol) utility program is commonly used for copying files to and from other computers. These computers may be at the same site or at different sites thousands of miles apart.

How to Copy Files From a Remote System (ftp) (System , Copying Files from an FTP Server to another directory on the same to move files from their FTP Server to another place on their FTP Server? Another workaround is to open a second connection to the FTP server and make the server upload the file to itself by piping a passive mode data connection to an active mode data connection. Implementation of this solution (in PHP though) is shown in FTP copy a file to another place in same FTP.

The code below makes the FTP server to upload the file to itself (using loopback connection). It needs the FTP server to allow both passive and active connection mode.

If you want to understand the ftp commands here is a list of them : List of ftp commands

function copyFile($filePath, $newFilePath)
{
    $ftp1 = ftp_connect('192.168.1.1');
    $ftp2 = ftp_connect('192.168.1.1');
    ftp_raw($ftp1, "USER ftpUsername");
    ftp_raw($ftp1, "PASS mypassword");
    ftp_raw($ftp2, "USER ftpUsername");
    ftp_raw($ftp2, "PASS mypassword");

    $res = ftp_raw($ftp2, "PASV");
    $addressAndPort = substr($res[0], strpos($res[0], '(') + 1);
    $addressAndPort = substr($addressAndPort, 0, strpos($addressAndPort, ')'));

    ftp_raw($ftp1, "CWD ." . dirname($newFilePath));
    ftp_raw($ftp2, "CWD ." . dirname($filePath));
    ftp_raw($ftp1, "PORT ".$addressAndPort);

    ftp_raw($ftp1, "STOR " . basename($newFilePath));
    ftp_raw($ftp2, "RETR " . basename($filePath));

    ftp_raw($ftp1, "QUIT");
    ftp_raw($ftp2, "QUIT");
}

How to Use FTP to Transfer Files Between Servers and Local , How to Copy Files From a Remote System ( ftp ) In this example, the same user kryten uses the mget command to copy a set of files from the /tmp directory to  To copy multiple files at once, use the mget command. ftp> mget filename [filename ] You can supply a series of individual file names and you can use wildcard characters. The mget command copies each file individually, asking you for confirmation each time. Close the ftp connections.

Basic FTP Commands, The File Transfer Protocol (FTP) is a set of rules that computers on a network use to communicate with one another. The tool allows users to  The basic FTP protocol does not support this I don't believe, so it really comes down to extensions that some FTP server or FTP clients might build in. Certainly a specific FTP server program has access to the local file system, so can move files around, but there isn't a standard FTP command to support that.

FileZilla: How to copy files from one directory to another on the same , The FTP (File Transfer Protocol) utility program is commonly used for copying files to These computers may be at the same site or at different sites thousands of miles apart. mkdir, to make a new directory within the current remote directory. To copy multiple files at once, use the mput command. ftp> mput filename [ filename] You can supply a series of individual file names and you can use wildcard characters. The mput command copies each file individually, asking you for confirmation each time.

ftp Command, Some FTP and SFTP servers support proprietary or non-standard extensions for this though. Some FTP/SFTP clients do support remote file duplication. Either  FTP, or “File Transfer Protocol” is a popular method of transferring files between two remote systems. SFTP, which stands for SSH File Transfer Protocol, or Secure File Transfer Protocol, is a separate protocol packaged with SSH that works in a similar way over a secure connection.

Comments
  • Stan. It has been 7 years since he asked this simple question and it has been 7 years since everyone has to work to complete this task. FTP only allows renaming and there is no "Copy From To As" command, so uploading the same file twice with different names is still a waste of resources.
  • I would like to thank you for the awesome tool that is WinSCP.
  • I wonder if you used this and specified localhost if you could get around that minor bottleneck. Even so, we need to consider that many FTP servers block FXP (also known as server-to-server transfers) due to "FTP bounce attacks". But a smart FTP server won't block it for localhost. Still, it might just block all FXP.
  • @MartinPrikryl Well let me tell you it does work because I use this personnally on a Synology Nas. Moreover it does answer the question because you just need to upload your file to the ftp one time and use my function to copy it wherever you want without uploading it again. Please next time try to test a solution first before saying it wont work :)
  • Sorry, you are right, I did not read the code carefully. Though next time, do include some explanation into your posts, to avoid confusion. +1 + I've linked your answer from mine.
  • I'll try to explain more next time.Thanks for the edit ;)
  • Ntb, this is basically use of FXP protocol, but for one server.
  • I think it will still download the file temporarily to your machine and then immediately upload it to your webdrive. I suspect you will still require adequate diskspace to achieve that.
  • 1) don't leave a 'signature' in your post, that's where your profile is for 2) C-Panel is only available in very specific cases.
  • This misses the point of the question - OP explicitly asked about copying, not about moving