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()
时间: 2024-10-13 12:40:10