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.