aboutsummaryrefslogblamecommitdiff
path: root/tests/rm-mail-parser-expected-struct.py
blob: 3dbc56ea8c544e9659ad8e7106d9ade0c2287c7d (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                                                                               
from os import listdir
from os.path import isfile, join
import sys

path = sys.argv[1]
onlyfiles = [join(path, f) for f in listdir(path) if isfile(join(path, f)) and len(f) > 4 and f[-4:] == ".txt"]

for p in onlyfiles:
    g = p[:-4] + ".eml"
    print(f"{p} -> {g}")
    with open(p, 'r+b') as inp:
        with open(g, 'w+b') as out:
            for line in inp:
                if b"EXPECTED STRUCTURE" in line:
                    break
                out.write(line)