I don't think it's possible but still I would like to ask if there is any command to transfer a remote file from one directory to other at an FTP prompt.

In more detail: I run ftp to a remote machine. I am at the ftp prompt, in the directory /a. By mistake, I have uploaded a file (via put) to this directory, but that's the wrong directory. I want to move the file from this directory to /a/b on the remote machine. Can I do this from the FTP prompt?

I have checked and I cannot telnet to that machine. If this is impossible in FTP, is there another way I can move the file and avoid having to transfer it again?

2 Answers 2


I think it depends more on the client that you're using. Take a look at the client, lftp. There's a good tutorial on using it here, titled: Unix: Flexibly moving files with lftp.

If you look through the help for lftp you'll notice the command mv.

$ lftp
lftp :~> help
    !<shell-command>                     (commands)                           alias [<name> [<value>]]             attach [PID]
    bookmark [SUBCMD]                    cache [SUBCMD]                       cat [-b] <files>                     cd <rdir>
    chmod [OPTS] mode file...            close [-a]                           [re]cls [opts] [path/][pattern]      debug [<level>|off] [-o <file>]
    du [options] <dirs>                  exit [<code>|bg]                     get [OPTS] <rfile> [-o <lfile>]      glob [OPTS] <cmd> <args>             help [<cmd>]
    history -w file|-r file|-c|-l [cnt]  jobs [-v]                            kill all|<job_no>                    lcd <ldir>
    lftp [OPTS] <site>                   ln [-s] <file1> <file2>              ls [<args>]                          mget [OPTS] <files>
    mirror [OPTS] [remote [local]]       mkdir [-p] <dirs>                    module name [args]                   more <files>
    mput [OPTS] <files>                  mrm <files>                          mv <file1> <file2>                   [re]nlist [<args>]
    open [OPTS] <site>                   pget [OPTS] <rfile> [-o <lfile>]     put [OPTS] <lfile> [-o <rfile>]      pwd [-p]
    queue [OPTS] [<cmd>]                 quote <cmd>                          repeat [OPTS] [delay] [command]      rm [-r] [-f] <files>
    rmdir [-f] <dirs>                    scache [<session_no>]                set [OPT] [<var> [<val>]]            site <site-cmd>                      source <file>
    torrent [-O <dir>] <file|URL>...     user <user|URL> [<pass>]             wait [<jobno>]                       zcat <files>                         zmore <files>
  • This works but note that you need write permission on both the source directory and the destination directory. and if the file already exists in the target directory, you also need write permission on it.
    – cas
    Commented Sep 20, 2013 at 9:04
  • Great slm, thanks for mentioning the command mv for the purpose.
    – Ravi
    Commented Sep 21, 2013 at 8:16
  • @Ravi - Glad this solved your problem, please mark this as the accepted answer so that others know your issue has been resolved.
    – slm
    Commented Sep 21, 2013 at 12:05
  • I hope the way I marked this as the accepted answer by clicking on the "V" symbol is fine. Thank you slm for your assistance
    – Ravi
    Commented Sep 21, 2013 at 12:58
  • @Ravi - yup, that's how you do it. Thanks for the questions!
    – slm
    Commented Sep 21, 2013 at 14:07

Use the rename command.

rename /a/myfile /a/b/myfile

I think most ftp clients use rename, not mv like lftp (as in slm's answer).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .