allows passing an input path as argument
This commit is contained in:
parent
47eb51e551
commit
af712a22ab
@ -13,11 +13,13 @@ import os
|
||||
import email
|
||||
from email import policy
|
||||
from multiprocessing import Pool
|
||||
import sys
|
||||
|
||||
EXTENSION = "eml"
|
||||
|
||||
OUTPATH = ""
|
||||
|
||||
def extract(filename):
|
||||
print(filename)
|
||||
"""
|
||||
Try to extract the attachments from all files in cwd
|
||||
"""
|
||||
@ -52,9 +54,10 @@ def extract(filename):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
path = sys.argv[1] or ""
|
||||
# let's do this in parallel, using cpu count as number of threads
|
||||
pool = Pool(None)
|
||||
res = pool.map(extract, glob.iglob("*.%s" % EXTENSION))
|
||||
res = pool.map(extract, glob.iglob("%s*.%s" % (path, EXTENSION)))
|
||||
# need these if we use _async
|
||||
pool.close()
|
||||
pool.join()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user