Skip to content

Commit

Permalink
Combining pattern files (number of results) to one file.
Browse files Browse the repository at this point in the history
  • Loading branch information
IvDinten committed Mar 23, 2022
1 parent 2545a8d commit 2a34b68
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions pattern_data_total.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env python
"""
Creates one file of all results files
"""
from os import walk
from dt.utils.files import remove_file_if_exists

results_path = "C:\\Users\\Imara\\Documents\\Server_results"
f = []
state = ""
for (dir_path, dir_names, filenames) in walk(results_path):
for file in filenames:
file_full_path = str(dir_path) + "\\" + str(file)
f.append(file_full_path)

remove_file_if_exists('pattern_data_total.csv')

with open('pattern_data_total.csv', 'w', encoding="utf-8") as outfile:
for entry in f:
if "pattern_data" not in entry:
continue
if "final" in entry:
state = "\u25B2final"
elif "initial" in entry:
state = "\u25B2initial"
with open(entry, encoding="utf-8") as infile:
file_input = infile.read().rstrip("\n") + state
outfile.write(str(file_input))
outfile.write("\n")

0 comments on commit 2a34b68

Please sign in to comment.