2011-05-11 61 views

回答

4
mput * 

ftp不能直接放目錄樹,只有文件。

+1

謝謝!我會接受沒有答案的答案!!] – zod

0

沒辦法。您必須單獨上傳每個文件。您可以先抓取目錄,然後上傳每個文件。你也有這個限制,通過ftp刪除一個目錄。

1

如果您在遠程系統上有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 
4

您可以使用ncftp軟件將目錄樹從本地服務器轉移到ftp服務器。 你需要安裝這個ftp軟件。

上傳命令是:

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

其中,

a轉移在ASCII模式下的所有文件,而不是二進制。

v看到詳細模式

R輸出遞歸模式來複制文件夾。

+0

這很有用。 ncftp有一個OSX Homebrew瓶子。 – Kushal

相關問題