3

Is it possible (and how) to copy a file on a remote machine to a different place on the same remote machine using FTP?

0

Do you specifically need to make a copy of the file, so that a full copy of it exists in each of two paths, as opposed to just moving/renaming a single instance of the file?

If so, the FTP protocol does allow it, in a couple of different ways:

  1. FTP has for a very long time allowed a user to coordinate server-to-server FTP transfers from one client. You could use this method via two separate control connections to the same server to get the server to "talk to itself" via FTP to transfer the file. See RFC 959 section 2.3 (specifically Figure 2), and section 5.2.
  2. The FTP "SITE" command allows any FTP server to provide "site specific" features, which could include allowing you to do copies.
2

I suspect it would depend on the ftp server, but you can accomplish a move with the ftp rename command.

  • I have total control on the kind of server I use, which one supports copy? – Itay Moav -Malimovka Mar 17 '10 at 18:34
0

Why do you want to use FTP instead of the OS copy|cp|whatever command for this? Do you only have FTP access to the server? Can you not telnet|ssh|RDP|etc instead?

Anyway, with FTP the name is giveaway: "transfer" and "protocol" should tell you that it's for transferring files across a network, and will have limited capability to interact with the filesystem. FTP isn't a general purpose filesystem tool.

0

You can rename file using RNFR and RNTO FTP commands (see Rename function in your favorite FTP client).

Most FTP servers does support renaming '/folder/file' to '/another/folder/another-file' as long as target directory does exists.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.