#!/usr/bin/env python #coding: UTF8 import os,sys import md5,tab from mysql_co.my_db import set_mysql from Ssh_co.ssh_conne CT import sshd from ssh_co.cfg.config import ssh_message,item_path from file import FindFile def my_mysql (): db_file={} My_connect=set_mysql () F_file=findfile.main (Item_path) list_file=findfile.file_list (f_file) see_file=my_connect.d isplay_db () for knumber,kname,ksgin,ksize,katime,kmtime in See_file:db_file[kname]=[ksgin,ksize,katime,kmtime] fo R fname,fsize,fatime,fmtime in List_file:if fname in Db_file.keys (): if ("%f")%fmtime = = ("%f")%db_file[fna ME][3]: print "%s The same mtime pass"%fname My_connect.set_file_attribute (10,fname,fmtime) Pass Else:print "%s different for Mtime"%fname My_connect.set_file_attribute (11,fname,fmtime) else:my_connect.add_db (fname,fsize,fatime,fmtime) My_connect.set_file_attribute (11,fname,fmtime) Print "%s,is new fiLe "%fname new_file=my_connect.new_db () my_connect.disconn_db () return new_file def my_ssh (new_file): Pid_host = 1 For Host_attribute in Ssh_message:ssh_conn=sshd (host_attribute,pid_host) for file_name in New_file:if fil E_name:a=ssh_conn.put_ssh_file (file_name[1]) print a print "Ssh_connect Memoryid:%s"%pid_host Else:pid_host = ID (host_attribute) ssh_conn.disconn_ssh () def main (): New_file=my_mysql () my_ssh (new_file) If __name__ = = "__main__": Main ()