First, look at Linux under:
Copy CodeThe code is as follows:
#! /bin/bash
cd/ftp/
Currentdate= ' Date +%y%m%d '
Yesterday= ' date-d yesterday +%y%m%d '
Threedayago= ' date-d ' 3 days ago ' +%y%m%d '
#echo $TWODAYAGO
Ftp-n-I 34.97.34.3 <<!
User Ftpuser Ftpuser
Bin
Mput $YESTERDAY. *
Delete $THREEDAYAGO. *
Bye
!
Note: This script combined with Linux crontab, timed the day before the data file to another server, and delete the first 3 days of data Files!
Second, the FTP script under Windows is divided into 2 parts:
1. Execution of documents
2. text file
The execution file suffix is *.bat:
Copy CodeThe code is as follows:
@echo off
CD/D E:\siis\code_tz\
Ftp-i-S: "D:\ftpscript\ftp.txt"
Exit
Text file:
Open 200.120.75.229
Ftpuser
Ftpuser
CD Siis
Bin
Mput *
Close
Bye
Note: This script, combined with scheduled tasks under Windows, is used to periodically update files in a directory on a remote server.
Articles you may be interested in:
- BAT script handling FTP Super Case analysis
- Use FTP to download the directory, which is the FTP command for bulk automatic download of bat files
- To back up files and upload the bat code to the FTP server
http://www.jb51.net/article/33787.htm
Automatic FTP scripting (shell Bat) under Linux and Windows