close
ncftpget:可以用在遠端檔案下載與上傳,那ftp也可以做的到,為什麼要介紹這軟體?
個人覺的他可以在command line 上面一行就把要做的工作處理好,挺炫的,這樣在自動化處理的script上,又可以寫的
更簡潔淨有力,
我們來比較一下ftp 的操作流程 (在linux上用command line方式操作)
假設我們有一個ftp server 192.168.1.1  username:abc password:1234 ,要把一個test.txt 的檔案upload到家目錄下的upload這個目錄下,之後離開ftp server
在操作上面有點像這樣
 ftp 192.168.1.1
 Connected to 192.168.1.1.
220 (vsFTPd 2.0.5)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (192.168.0.230:zynos):
#這裡要打username abc

331 Please specify the password.
Password:
#這裡要打password 1234
cd ~/upload
put test.txt
bye
這裡我們完成這樣的動作,共作了5個動作,如果你又要用binary去傳你的資料,那又更多了

如果用ncftpput 處理的話,用一行就搞定了:
指令如下:
    ncftpput -u abc -p 1234 192.168.1.1 upload ./test
這樣就可以感受到ncftp的強大之處了吧 ^_^
再來介紹安裝ncftp,在Red Hat or Fedora 指令如下:
yum -y install ncftp

ncftp 基本功能
 ncftp file_url  這樣可以直按捉檔案

這樣就可以用ncftp這軟體的功能,這軟體有ncftpput 和ncftpget 二種傳檔方式,看檔名就可以看出一個是put(upload)的一個是get(download):而用法如下


ncftp 進階功能
ncftpget用法:
ncftpget [flags] remote-host local-dir remote-path-names
ncftpput用法:
ncftpget [flags] remote-host remote-path-names local-file_name

ncftp的flags 整理如下
    -u XX  Use username XX instead of anonymous.
  -p XX  Use password XX with the username.
  -P XX  Use port number XX instead of the default FTP service port (21).
  -d XX  Use the file XX for debug logging.
  -a     Use ASCII transfer type instead of binary.
  -t XX  Timeout after XX seconds.
  -v/-V  Do (do not) use progress meters.
  -f XX  Read the file XX for host, user, and password information.
  -A     Append to local files, instead of overwriting them.
  -z/-Z  Do (do not) not try to resume downloads (default: -z).
  -E     Use regular (PORT) data connections.
  -F     Use passive (PASV) data connections (default).
  -DD    Delete remote file after successfully downloading it.
  -b     Run in background (submit job to "ncftpbatch").
  -B XX  Try setting the SO_RCVBUF size to XX.
  -r XX  Redial XX times until connected.
  -R     Recursive mode; copy whole directory trees.
  -T     Do not try to use TAR mode with Recursive mode.


值得注意,要upload的檔案如果在remote 主機己經有了,可是會直按蓋過去的,要小心點
arrow
arrow
    全站熱搜

    yuanann 發表在 痞客邦 留言(0) 人氣()