发布时间:2013-05-03 10:26:59
import hashlibdef checksum(path): fp=open(path) checksum=hashlib.md5() while True: buffer=fp.read(8192) if not buffer:break checksum.update(buffer) fp.close() checksum=checksum.digest() return checksu.........【阅读全文】
发布时间:2013-05-03 10:06:42
遍历目录下所有文件#!/usr/bin/env python######################os.getcwd()#os.mkdir()#os.listdir()#os.stat()#os.rmdir()#os.walk()#####################import ospath="/opt/python"def enumeratepaths(path=path): fullpath=[] for paths,dirs,files in os.walk(path): for .........【阅读全文】
发布时间:2013-05-02 18:06:34
实现两个目录的同步import subprocessimport sysimport timeimport ossource='/home/dcr/testpython/test03'target='/home/dcr/testpython/test02'rsync="rsync"arguments="-av"cmd="%s %s %s %s"%(rsync,arguments,source,target)def sync(): while True: .........【阅读全文】