Thursday, September 2, 2010

Bulk upload download Ftp Shell Script

for a long time I did not write technical articles Rights, has been busy practice. Hangzhou today, sunny, feel good, low-tech to point to share the two scripts are often used in the company. FTP bulk upload, ftput.sh: 01 #! / Bin / bash 02 for filename in $ @ 03 do 04 ftp-nv 192.168.130 .... Long time no write technical articles Rights Class has been busy practice. Hangzhou today, sunny, feel good, to point a low technology content, to share the two scripts are often used in the company.
FTP bulk upload, ftput.sh:

01 #! / Bin / bash

02 for filename in $ @



03 do

04 ftp-nv 192.168.130.2 <

05 user username password

06 prompt off

07 bin

08 mput $ filename

09 close

10!

11 done

FTP batch download, ftpget.sh

01 #! / Bin / bash

02 for filename in $ @

03 do

04 ftp-nv 192.168.130.2 <

05 user username password

06 prompt off

07 bin

08 mget $ filename

09 close

10!

11 done

Application method: modify the code under the (FTP address and user name password change it) save as ftput.sh, the file to upload can be executed as a script argument. As

1 sh. / Ftput.sh *. jpg 123.txt config.xml

Is that all jpg files and upload the two files 23.txt config.xml to ftp.

No comments:

Post a Comment