output files to same input dir

This commit is contained in:
Audrey Aaliyah Jensen 2023-09-08 09:19:47 -05:00
parent adf5512106
commit 087566a737

View File

@ -14,9 +14,10 @@ import email
from email import policy from email import policy
from multiprocessing import Pool from multiprocessing import Pool
import sys import sys
import re
EXTENSION = "eml" EXTENSION = "eml"
OUTPATH = "" OUTREGEX = ".*\\\\"
def extract(filename): def extract(filename):
print(filename) print(filename)
@ -24,7 +25,8 @@ def extract(filename):
Try to extract the attachments from all files in cwd Try to extract the attachments from all files in cwd
""" """
# ensure that an output dir exists # ensure that an output dir exists
od = "output" filepath = re.findall(OUTREGEX, filename)
od = (filepath[0] or "") + "/output"
os.path.exists(od) or os.makedirs(od) os.path.exists(od) or os.makedirs(od)
output_count = 0 output_count = 0
try: try: