How to move files using FTP commands

FtpCommandRenameMove

Ftp Problem Overview


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?

Ftp Solutions


Solution 1 - Ftp

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

Solution 2 - Ftp

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.

Solution 3 - Ftp

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKermiaView Question on Stackoverflow
Solution 1 - FtpJohanView Answer on Stackoverflow
Solution 2 - FtpStephanView Answer on Stackoverflow
Solution 3 - FtpCSGarudkarView Answer on Stackoverflow