Ads 468x60px

##EasyReadMore##

24 10月, 2013

[NCFTP] ubuntu 下輸入命令 FTP 自動上下傳

image

本來用 lftp 來輸入指令讓檔案自動上傳

但在某些伺服器下會進不了子目錄

只好另尋別的 ftp 軟體

sudo apt-get install ncftp

記錄一些自己常用的:

1.公司圖片用做分發的。 (本機上傳至遠程)
ncftpput -u username -p password hostname   /hotnewnet.com/catalog/images *.*
將本目錄的所有文件上傳到hostname主機下的 /hotnewnet.com/catalog/images目錄

2.測試單個文件。 (本機上傳至遠程)
D:\websites\catalog>ncftpput -u username -p password hostname   /httpdocs 123.txt
將本目錄的123.txt文件上傳到hostname主機下的 /httpdocs 目錄

3.文件下載   (遠程下載到本機)
D:\websites\catalog>ncftpget -u username -p password hostname . /httpdocs/123.txt
將hostname主機下的/httpdocs/123.txt 下載到本機的當前目錄(注意.)

3.文件下載至子目錄 (遠程下載到本機)
D:\websites\catalog>ncftpget -u username -p password hostname ./admin /httpdocs/123.txt
將hostname主機下的/httpdocs/123.txt 下載到本機當前目錄的/admin下面(注意./)

ncFTP - 命令行上傳下載文件或文件夾

ncftp與傳統的ftp相比,主要有以下改進或變化:
1、子目錄下載,採用遞歸的方法,下載整個目錄及其子目錄。
2、支持斷點續傳。一次傳輸沒有完成,下次可以接著傳輸未完成的文件。
3、匿名ftp自動登錄。目前大部分ftp站點都可以匿名登錄,ncftp可以自動登錄(默認方式)。
4、支持通過防火牆傳輸和代理服務器。
5、支持書籤功能,可以將某個位置存在書籤中方便以後直接跳轉。
6、可以顯示下載進度。
7、顯示傳輸速率。
8、文件列表自動滿頁暫停。當ls文件列表超過一屏,ncftp會自動暫停,等待任意鍵繼續。
9、默認是以binary方式傳輸數據。
10、支持文件名自動完成。例如服務器上有文件download.list,您只要輸入get down,系統可以自動填充文件名為download.list。
11、自動記憶站點的離開時的目錄,下次登錄會自動進入那個目錄。

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).
-j XX Use account XX with the account (deprecated).
-d XX Use the file XX for debug logging.
-e XX Use the file XX for error logging.
-U XX Use value XX for the umask.
-t XX Timeout after XX seconds.
-a     Use ASCII transfer type instead of binary.
-m     Attempt to mkdir the dstdir before copying.
-v/-V Do (do not) use progress meters.
-f XX Read the file XX for host, user, and password information.
-h XX Connect to host XX. Useful for overriding host in -f config.file.
-c     Read locally from stdin and write remotely to specified pathname.
-C     Similar to -c, except a local pathname is specified.
-A     Append to remote files instead of overwriting them.
-z/-Z Do (do not) try to resume uploads (default: -Z).
-T XX Upload into temporary files prefixed by XX.
-S XX Upload into temporary files suffixed by XX.
-DD    Delete local file after successfully uploading it.
-b     Run in background (submit job to “ncftpbatch” and run).
-bb    Same as “-b” but queue only (do not run “ncftpbatch”).
-E     Use regular (PORT) data connections.
-F     Use passive (PASV) data connections (default).
-y     Try using “SITE UTIME” to preserve timestamps on remote host.
-B XX Try setting the SO_SNDBUF size to XX.
-r XX Redial XX times until connected.
-o XX Specify miscellaneous options (see documentation).
-W XX Send raw FTP command XX after logging in.
-X XX Send raw FTP command XX after each file transferred.
-Y XX&n
bsp; Send raw FTP command XX before logging out.
-R     Recursive mode; copy whole directory trees.

Examples:
ncftpput -u gleason -p my.password Elwood.probe.net /home/gleason stuff.txt
ncftpput -u gleason Elwood.probe.net /home/gleason a.txt (prompt for pass)
ncftpput -a -u gleason -p my.password -m -U 007 Bozo.probe.net /tmp/tmpdir

http://hi.baidu.com/yinkeju/item/2fdb7f0e23c7d590a2df4379

http://tompig.iteye.com/blog/1101000

0 意見:

張貼留言

 
Blogger Templates