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