Is it possible (and how) to copy a file on a remote machine to a different place on the same remote machine using FTP?
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:
- 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.
- The FTP "SITE" command allows any FTP server to provide "site specific" features, which could include allowing you to do copies.
I suspect it would depend on the ftp server, but you can accomplish a move with the ftp
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.
You can rename file using
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.