put filename will put the file to cureent directory in server.
我应该使用哪个命令来移动整个文件夹或目录?
您可以使用 ncftp
软件将本地目录树上传到FTP服务器。您需要安装这个FTP软件。
上传命令如下:
ncftpput -avR -u <user> -p<password> <ftpserver> <path to put> <local folder>
其中,
a
用ASCII模式传输所有文件而不是二进制模式。
v
以详细模式查看输出
R
以递归模式复制文件夹。
mput *
FTP无法直接上传文件夹树,只能上传文件。
如果您在远程系统上安装了sshd
,那么您可能可以使用rsync
。
它具有内置压缩和各种其他好处:
% rsync -chavz --partial --progress --stats test remotehost:
sending incremental file list
test/
test/test.c
387 100% 0.00kB/s 0:00:00 (xfer#1, to-check=5/7)
test/test.cpp
231 100% 225.59kB/s 0:00:00 (xfer#2, to-check=4/7)
test/test.new
253 100% 123.54kB/s 0:00:00 (xfer#3, to-check=3/7)
test/test.php
578 100% 282.23kB/s 0:00:00 (xfer#4, to-check=2/7)
test/test.py
288 100% 140.62kB/s 0:00:00 (xfer#5, to-check=1/7)
test/test.sh
81 100% 26.37kB/s 0:00:00 (xfer#6, to-check=0/7)
Number of files: 7
Number of files transferred: 6
Total file size: 1.82K bytes
Total transferred file size: 1.82K bytes
Literal data: 1.82K bytes
Matched data: 0 bytes
File list size: 193
File list generation time: 0.003 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 1.54K
Total bytes received: 130
sent 1.54K bytes received 130 bytes 159.43 bytes/sec
total size is 1.82K speedup is 1.09
观察一下如果再次运行它,而且没有文件发生改变会发生什么...
% rsync -chavz --partial --progress --stats test remotehost:
sending incremental file list
Number of files: 7
Number of files transferred: 0
Total file size: 1.82K bytes
Total transferred file size: 0 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 193
File list generation time: 0.003 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 207
Total bytes received: 13
sent 207 bytes received 13 bytes 23.16 bytes/sec
total size is 1.82K speedup is 8.26
不行,你必须单独上传每个文件。你可以先爬取目录,然后再上传每个文件。通过ftp删除目录也有此限制。