Achieved under linux ftp upload files

Upload:

#! / bin / SH 

the SET -x 
the SET -e 
local_rootPath = / hadoop / datadir / windeploy / the TEMP 

Host = "192.168.12.2" # need to upload ftp address 
port = "21" # port 
user = "ftpuser" # ftp landing username  
passwd = "123456" # ftp login password 
the Customer = "aaa" 

the FTP -n <<! #! is a beginning - at the end, you can do other change, such as EOF, consistent attention before and after the 
open $ host $ port 
the User $ the User $ passwd 
binary # binary upload 
hash  
cd / # to switch to the root directory of the ftp 
lcd $ local_rootPath / $ customer # to switch to the directory the local server 
prompt 
mput * # upload all the files under $ local_rootPath / $ customer directory to the root directory of ftp
close bye !

download:

#! / bin / bash 

Export File = *. CSV file to be downloaded # Type 
Host = "192.168.1.203" 
Port = "21" 
the User = "the User" 
passwd = "123456" 

the FTP -v -n << EOF 
Open $ Host $ Port 
the User $ the User $ passwd 
binary 
cd / the Data # to switch to the ftp directory 
lcd / hadoop / datadir / ggg / file / data # defined to be downloaded to a local directory 
mget $ file # mget where you can use regular batch matching, if use only get it is to download a single file 
prompt # end an interactive 
BYE 
EOF 
echo "successfully get from the FTP"

  

  

Guess you like

Origin www.cnblogs.com/Gxiaobai/p/12339901.html