68

Path of source file is : /public_html/upload/64/SomeMusic.mp3

And I want to move it to this path : /public_html/archive/2011/05/64/SomeMusic.mp3

How can i do this using FTP commands?

Kermia
  • 4,171
  • 13
  • 64
  • 105

3 Answers3

104

In FTP client:

rename /public_html/upload/64/SomeMusic.mp3 /public_html/archive/2011/05/64/SomeMusic.mp3

With FTP commands:

RNFR /public_html/upload/64/SomeMusic.mp3
RNTO /public_html/archive/2011/05/64/SomeMusic.mp3

source: http://www.nsftools.com/tips/RawFTP.htm

Johan
  • 1,094
  • 1
  • 8
  • 4
  • @Johan can I use one command line like: `RNFR /public_html/upload/64/SomeMusic.mp3 RNTO /public_html/archive/2011/05/64/SomeMusic.mp3`? – user2545330 Mar 23 '14 at 10:18
  • 1
    @user2545330 No, those are two separate FTP commands. Though in most (command-line) FTP clients, you cannot use those commands directly anyway (you can use `quote RNFR /public_html/upload/64/SomeMusic.mp3` and `quote RNTO /public_html/archive/2011/05/64/SomeMusic.mp3`). Why would you, if you can use the `rename /public_html/upload/64/SomeMusic.mp3 /public_html/archive/2011/05/64/SomeMusic.mp3`? – Martin Prikryl Oct 10 '16 at 13:29
2

Just in case someone else will search for a solution to move files by ftp and will not find a solution: As I encountered the same problem and even the RNFR and RNTO will not work like in my case: I solved this by doing the following workaround:

mget files*.ext
cd /path/to/desired/folder/
mput files*.ext

This is twice the traffic (get and put) but for smaller files it is at least a solution.

Stephan
  • 21
  • 1
1

Just in case if you're getting Invalid Command when executing the RNFR and RNTO commands. Then use below you'll be able to move the files.

quote RNFR /from_path/filename.txt
quote RNTO /to_path/filename.txt
CSGarudkar
  • 11
  • 1
  • Do you really have an `ftp` client that does not support `rename` command? See [my comment to the @Johan's answer](https://stackoverflow.com/q/9461844/850848#comment67198460_9462082). – Martin Prikryl May 18 '21 at 12:11