标签:blog os 文件 div log sp line on new
import os import shutil vpath = "H:/v3/b/" fobj = open(‘H:/v3/a.txt‘,‘rb‘) line = fobj.readline() while line: line = line.strip(‘\r\n‘) filepath = line.split(‘\t‘)[-1] filepath = filepath.strip(‘ ‘) sha1 = filepath.split(‘\\‘)[-1] foldname = line.split(‘\t‘)[0].split(‘.‘)[-2] newpath = os.path.join(vpath,foldname) if(os.path.exists(newpath)): if(os.path.exists(filepath)): shutil.move(filepath, os.path.join(newpath,sha1)) else: os.makedirs(newpath) if(os.path.exists(filepath)): shutil.move(filepath, os.path.join(newpath,sha1)) line = fobj.readline() fobj.close()
标签:blog os 文件 div log sp line on new
原文地址:http://www.cnblogs.com/xiaobaichuangtianxia/p/3939884.html