Batch download of FTP files

Source: Internet
Author: User
Tags ftp commands

The store terminal transmits the sales data to the designated FTP server of the company through the front-end sales system every day. Although client software can be used to batch download files from ftp, such software basically requires manual operations. In our company, store sales data is uploaded every moment, in this case, manual download is too annoying. So I thought of how to download files in a specified time period by combining batch processing with scheduled tasks.

First, create a new file named “ftpdownloadfiles.txt. The specific content is as follows:

Username // FTP User Name

Password // FTP Password

The FTP path where the CD Data/day // file is located. There is no "/" before the first directory.

Prompt // No download confirmation prompt during File Download

Mget *. * // download all files in the specified directory

Mdelete *. * // delete all objects after download

Quit // exit the FTP status

The reason for using mget and mdelete is that the get and delete commands only download a single file and specify a specific file name. Wildcards are not allowed. If prompt is not used, each time a file is downloaded, you must be confirmed before it can be downloaded.

Then, create a new text file named "ftpdownload. Bat" with the following content:

Echo off
Before FTP-S: D: \ My Documents \ batch processing command \ ftpdownloadfiles.txt 127.0.0.1/hosts, you need to add the file path. Here, you need to replace it with your own file path; "-s" means to execute the FTP commands in the text file in sequence.

D: // Since the batch processing command is used, all files on the FTP server are downloaded to all the folders of the batch processing, so you need to move the downloaded files to the specified folder, the specified folder here is c: \ pos.

CD my documents

CD Batch Processing Command

Copy *. zip c: \ pos // because all files uploaded by the store are zip files, only copy these files here. Of course, wildcard * can be used *. * Copy all files.

Del *. Zip // delete all files after copying

Echo on

Exit

After the files are saved, the batch files are created. The next step is to add the batch processing file to the scheduled task and execute it at intervals. My own setting is to download once every 30 minutes.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.