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