FTP Real-time update upload script

Source: Internet
Author: User

Recently customers need to use FTP upload video business to me. 0.0 is very tangled why do not give the URL, do not want to give FTP, I also have to download upload to our server

Groped for a moment and wrote a brief script. (finally useless, with someone else's python written) determined to learn python!!!!

Script:

#!/bin/bash

u=

p=

ip=

dir= #本地机器主目录 (directory after CP)

backup=#本地机器备份目录 (First update Catalog)

rec=#远程FTP的目录

Date= ' Date +%y%m%d%h%m '


If [$#-eq 0];then

#第一次进入为了获取文件名

Ftp-n <<eof

Open $ip

User $u $p

Binary

Nlist ${rec} ${dir}/out.txt

Prompt

Close

Bye

Eof


For file in ' Cat OUT.txt '

#仅为了更新backup目录的文件

Do

Ftp-n <<eof

Open $ip

User $u $p

Binary

LCD ${backup}

Newer ${file}

Prompt

Close

Bye

Eof


#比对文件是否更新, make an update backup

Mkdir-p ${dir}backup/${file}/${date}/

\cp-b-u-f ${backup}${file} ${dir}

MV ${dir}/*~ ${dir}backup/${file}/${date}/



Done


Else

echo "Please input Comand1"

echo "Usage:sh ftp.sh"

Fi



650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0064.gif "alt=" j_0064.gif "/> really sometimes write their own, after a period of time to look back, What does this special write?

This article is from "A Primary OPS growth page" blog, please make sure to keep this source http://12783629.blog.51cto.com/12773629/1971030

FTP Real-time update upload script

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.