也许重命名在ftp命令可以为你工作吗?
rename [from [to]]
Rename the file from on the remote machine, to the file to.
我给它一个bash使用旧的文件我已经坐在一台服务器上,它似乎你想要做什么:
ftp> ls tmp/test*
229 Entering Extended Passive Mode (|||55572|)
150 Accepted data connection
-rw-r--r-- 1 sinasohn sinasohn 21 Mar 31 16:37 tmp/testfile01
226-Options: -a -l
226 1 matches total
ftp> ls tmp2/test*
229 Entering Extended Passive Mode (|||64715|)
150 Accepted data connection
226-Options: -a -l
226 0 matches total
ftp> rename tmp/testfile01 tmp2/testfile01
350 RNFR accepted - file exists, ready for destination
250 File successfully renamed or moved
ftp> ls tmp/test*
229 Entering Extended Passive Mode (|||56698|)
150 Accepted data connection
226-Options: -a -l
226 0 matches total
ftp> ls tmp2/test*
229 Entering Extended Passive Mode (|||50239|)
150 Accepted data connection
-rw-r--r-- 1 sinasohn sinasohn 21 Mar 31 16:37 tmp2/testfile01
226-Options: -a -l
226 1 matches total
ftp>
我把空行命令之间这里清晰。
希望这会有所帮助!
谢谢你的建议。我试过这个,虽然rename命令不支持通配符,所以我需要一种方法来使用通配符,即使这意味着要有一个单独的脚本来执行在ftp中移动文件的任务。再次感谢! – Danny
ftp中的** ls **命令允许您为输出指定本地文件名。你可以做一个_ls * filelist.txt_,然后解析该文件以获取在重命名语句中使用的文件列表? –
我如何解析filelist.txt?你有一个例子吗? – Danny