(1) FTP automatic batch download file
# # # # # # #从ftp服务器上的/DATA/LOCALACC to the local/data/localacc#### #!/bin/Bash FTP-n<<!//-N is an automatic login that does not use FTPOpen10.0.129.170 //Open Host[port]: establishes the specified FTP server connection, can specify the connection portUser SFHC sfhc1234//user username password: to indicate to the remote host their identity, require a password, you must enter a password, such as: User anonymous [email protected]Binary//binary: Sets the file transfer mode to binary, which defaults to ASCII. Binary mode does not do any processing of the data, and ASCII mode converts the carriage return line to the return character of the machine. Cd/data/localacc//CD Remote-dir: Enter the remote host directory Remote-dirLcd/data/localacc//LCD local-dir: Switch the local working directory to Local-dirPrompt//prompt: Set the interactive prompt for multiple file transfers (default is prompt, bulk download prompts in each file, enter Y to transfer the next file, prompt can cancel interactive hints)Mget *.gz//mget remote-files: Download multiple remote filesClose//Close: Interrupts the FTP session with the remote serverBye//Bye: Exiting the ftp session!//!: Perform interactive shell,exit on local machine back to FTP environment
(2) FTP automatic batch upload file
# # # #本地的/data/localacc#### #!/bin/bash -n<<! on/DATA/LOCALACC to FTP server 10.0. 129.171 user SFHC sfhc1234 binary hash //Hash: 1024 bytes per transfer, showing a hash symbol (#) cd/data/localacc /data/localacc prompt * */ / Mput local-files: Transfer multiple files to the remote host close bye !
FTP automatic login upload download file