Linux FTP命令将目录从本地系统放入服务器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5970736/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 04:02:04  来源:igfitidea点击:

FTP command to put a directory to server from local system

linuxshellunixftp

提问by zod

put  filename  will put the file to cureent directory in server.

Which command i have to use to move a entire folder/ directory??

我必须使用哪个命令来移动整个文件夹/目录?

采纳答案by jm666

mput *

ftp can't put directly directory trees, only files.

ftp 不能直接放置目录树,只能放置文件。

回答by ShirazITCo

No way. you must upload each files separate. you can first crawl directories and then upload each file. you have this limit too for delete a directory via ftp.

没门。您必须单独上传每个文件。您可以先抓取目录,然后上传每个文件。您也有此限制,可以通过 ftp 删除目录。

回答by Johnsyweb

If you have sshdon the remote system, you can probably use rsync.

如果您sshd在远程系统上,您可能可以使用rsync.

It has built-in compression and all sorts of other goodness:

它具有内置的压缩​​和各种其他优点:

% 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

Watch what happens if you run it again and no files have changed...

看看如果你再次运行它并且没有文件改变会发生什么......

% 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

回答by Amit Patel

You can use ncftpsoftware to put directory tree from local to ftp servers. You need to install this ftp software.

您可以使用ncftp软件将目录树从本地放到 ftp 服务器。你需要安装这个ftp软件。

Upload command would be:

上传命令将是:

ncftpput -avR -u <user> -p<password> <ftpserver> <path to put> <local folder>

where,

在哪里,

atransfer all files in ASCII mode and not in binary.

a以 ASCII 模式而非二进制传输所有文件。

vto see output in verbose mode

v以详细模式查看输出

Rto copy folders in recursive mode.

R以递归模式复制文件夹。