如何在sftp服务器中移动文件?


Answers:


28

mvsftp交互模式下没有命令。使用rename代替。

要了解哪些命令可用,请检查手册页man sftp或类型help之内sftp


6
sftp的rename工作原理就像mv在shell中一样!
Devy 2014年

2
@Devy除通配符外,如果移至目录,则省略文件名!
pstanton

2

客户端lftp可用于FTP和SFTP。它具有mv可用于在远程服务器上执行移动的命令。这里有一个很好的使用它的教程,标题为:Unix:使用lftp灵活地移动文件

如果您仔细查看lftp用法,您会注意到一个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>

参考文献

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.