Automatic ftp script (shell bat) in linux and windows)

Source: Internet
Author: User

I. First, let's look at the following in linux:

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
Bin
Mput $ YESTERDAY .*
Delete $ THREEDAYAGO .*
Bye
!

Note: This script combines the crontab in linux to regularly upload the data file of the previous day to another server and delete the data file of the previous three days!

2. the ftp script in windows is divided into two parts:
1. Execution File
2. Text Files

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 is used in combination with scheduled tasks in windows to regularly update files in a directory of a remote server.

Related Article

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.