def _copy_temp_directory(self):
"""Copy the temp directory to the output directory."""
if os.path.exists(self.paths['output']):
oldfiles = [f for f in os.listdir(self.paths['output'])]
for oldfile in oldfiles:
os.remove(os.path.join(self.paths['output'], oldfile))
newfiles = [f for f in os.listdir(self.paths['temp'])]
for newfile in newfiles:
shutil.copy2(os.path.join(self.paths['temp'], newfile), self.paths['output'])
else:
try:
shutil.copytree(self.paths['temp'], self.paths['output'])
except shutil.Error as err:
self.exit(err)
shutil.rmtree(self.paths['temp'])
评论列表
文章目录