In the past few days, due to business needs, we have provided a batch processing for our own use. Since we have never written this before, we may
It took a day to download files. It was so stupid, haha. If you have time, you may want to complete it into a common one. You can set several variables to achieve remote FTP file download.
You are also looking forward ......
Note: If the local file already exists, it will not be downloaded.
@ Echo off <br/> ECHO is creating the FTP file that generates the file list. Please wait ............ <Br/> Ping-N 3 127.1> NUL <br/> echo FTP User Name> command.txt <br/> echo FTP password> command.txt <br/> echo Type Binary> command.txt <br/> echo CD databaseback> command.txt <br/> echo MLS db_hxxl D: /db_hxxl.txt> command.txt <br/> echo MLS db_oa D:/db_oa.txt> command.txt <br/> echo MLS master D: /master.txt> command.txt <br/> echo MLS Model D:/model.txt> command.txt <br/> echo mls msdb d:/msdb.txt> command.txt <br/> echo Close> command.txt <br/> echo quit> command.txt </P> <p> ECHO is creating the directory file list on the server. Please wait ............ <Br/> Ping-N 3 127.1> NUL <br/> echo. <br/> FTP-I-s: command.txt remote server-u Server IP address <br/> Del command.txt </P> <p> ECHO is downloading the db_hxxl folder backup, please wait ............ <Br/> Ping-N 3 127.1> NUL <br/> for/F % I In (d:/db_hxxl.txt) Do (if not exist D: /dbback/db_hxxl/% I (<br/> echo FTP Username> D:/getfiles.txt <br/> echo FTP password> D: /getfiles.txt <br/> echo Type Binary> D:/getfiles.txt <br/> echo CD databaseback> D:/getfiles.txt <br/> echo CD db_hxxl> D: /getfiles.txt <br/> echo LCD d:/dbback/db_hxxl> D:/getfiles.txt <br/> echo mget % I> D: /getfiles.txt <br/> echo close> D:/getfil Es.txt <br/> echo quit> D:/getfiles.txt <br/> FTP-I-s: D:/getfiles.txt remote server-u Server IP address <br/> Del D: /getfiles.txt <br/>) </P> <p> ECHO is downloading the db_oa folder backup. Please wait ............ <Br/> Ping-N 3 127.1> NUL <br/> for/F % I In (d:/db_oa.txt) Do (if not exist D: /dbback/db_oa/% I (<br/> echo FTP Username> D:/getfiles.txt <br/> echo FTP password> D: /getfiles.txt <br/> echo Type Binary> D:/getfiles.txt <br/> echo CD databaseback> D:/getfiles.txt <br/> echo CD db_oa> D: /getfiles.txt <br/> echo LCD d:/dbback/db_oa> D:/getfiles.txt <br/> echo mget % I> D: /getfiles.txt <br/> echo close> D:/getfiles.txt <B R/> echo quit> D:/getfiles.txt <br/> FTP-I-s: D:/getfiles.txt remote server-u Server IP address <br/> Del D: /getfiles.txt <br/>) </P> <p> ECHO is downloading the backup in the master folder of the system database. Please wait ............ <Br/> Ping-N 3 127.1> NUL <br/> for/F % I In (d:/master.txt) Do (if not exist D: /dbback/master/% I (<br/> echo FTP Username> D:/getfiles.txt <br/> echo FTP password> D: /getfiles.txt <br/> echo Type Binary> D:/getfiles.txt <br/> echo CD databaseback> D:/getfiles.txt <br/> echo CD master> D: /getfiles.txt <br/> echo LCD d:/dbback/Master> D:/getfiles.txt <br/> echo mget % I> D: /getfiles.txt <br/> echo close> D:/getfiles. t XT <br/> echo quit> D:/getfiles.txt <br/> FTP-I-s: D:/getfiles.txt remote server-u Server IP address <br/> Del D: /getfiles.txt <br/>) </P> <p> ECHO is downloading the backup of the system database model folder. Please wait ............ <Br/> Ping-N 3 127.1> NUL <br/> for/F % I In (d:/model.txt) Do (if not exist D: /dbback/model/% I (<br/> echo FTP Username> D:/getfiles.txt <br/> echo FTP password> D: /getfiles.txt <br/> echo Type Binary> D:/getfiles.txt <br/> echo CD databaseback> D:/getfiles.txt <br/> echo CD model> D: /getfiles.txt <br/> echo LCD d:/dbback/model> D:/getfiles.txt <br/> echo mget % I> D: /getfiles.txt <br/> echo close> D:/getfiles.txt <B R/> echo quit> D:/getfiles.txt <br/> FTP-I-s: D:/getfiles.txt remote server-u Server IP address <br/> Del D: /getfiles.txt <br/>) </P> <p> ECHO is downloading the MSDB folder backup of the system database. Please wait ............ <Br/> Ping-N 3 127.1> NUL <br/> for/F % I In (d:/msdb.txt) Do (if not exist D: /dbback/MSDB/% I (<br/> echo FTP Username> D:/getfiles.txt <br/> echo FTP password> D: /getfiles.txt <br/> echo Type Binary> D:/getfiles.txt <br/> echo CD databaseback> D:/getfiles.txt <br/> echo cd msdb> D: /getfiles.txt <br/> echo LCD d:/dbback/MSDB> D:/getfiles.txt <br/> echo mget % I> D: /getfiles.txt <br/> echo close> D:/getfiles.txt <br/> echo quit> D:/getfiles.txt <br/> FTP-I-s: D: /getfiles.txt remote server-u Server IP address <br/> Del D:/getfiles.txt <br/>) <br/>