-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopyFiles.py
35 lines (32 loc) · 1.12 KB
/
copyFiles.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
import argparse
from shutil import copyfile
import shutil
def run(logFile,fileDir):
inDir = os.path.join(fileDir,"input")
outDir = os.path.join(fileDir,"output")
badDir = os.path.join(fileDir,"bad")
with open(logFile,'r') as file:
for line in file.read().split('\n'):
try:
copyfile(os.path.join(inDir,line),os.path.join(badDir,line))
copyfile(os.path.join(inDir,line+".clean"),os.path.join(badDir,line+".clean"))
copyfile(os.path.join(outDir,line),os.path.join(badDir,line[:-4]+"_merged.xml"))
except IsADirectoryError:
continue
return
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='This is a script to find SpRL file data that did not find its way into a core file.')
parser.add_argument(
"--path",
dest="path",
required=True,
help='Path to the input files')
parser.add_argument(
"--file",
dest="file",
required=True,
help='Core SpRL log file')
args=parser.parse_args()
run(args.file,args.path)