时间:2021-07-01 10:21:17 帮助过:38人阅读
#! python #coding:utf-8 ##!/usr/bin/python # Filename : fileCp.py import sys import os import shutil fileList='filelist.txt' targetDir='files' filedir = open(fileList) line = filedir.readline() log = open('running.log','w') while line: line = line.strip('\n'); basename = os.path.basename(line) exists = os.path.exists(line) if exists : print 'copy '+line+' to '+os.getcwd()+'/'+targetDir+'/'+basename log.write('copy '+line+' to '+os.getcwd()+'/'+targetDir+'/'+basename+'\r\n') shutil.copy(line,targetDir+'/'+basename) else: print line+' not exists' log.write(line+' not exists'+'\r\n') line = filedir.readline() log.close()