Added ability to define output directory
This commit is contained in:
+5
-1
@@ -32,6 +32,7 @@ def parse_args():
|
||||
parser.add_argument("--port", type=int, help="Custom port (default: 993 for SSL, 143 otherwise)")
|
||||
parser.add_argument("--limit", type=int, help="Limit number of emails to download (for debugging)")
|
||||
parser.add_argument("--full", action="store_true", help="Download all emails (default: only new emails since last run)")
|
||||
parser.add_argument("--store", type=str, help="Directory to store downloaded emails (default: ./download)")
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
@@ -313,7 +314,10 @@ def main():
|
||||
args = parse_args()
|
||||
|
||||
email_folder = sanitize_filename(args.email, max_length=100)
|
||||
base_dir = os.path.join(os.getcwd(), 'download', email_folder)
|
||||
if args.store:
|
||||
base_dir = os.path.join(args.store, email_folder)
|
||||
else:
|
||||
base_dir = os.path.join(os.getcwd(), 'download', email_folder)
|
||||
os.makedirs(base_dir, exist_ok=True)
|
||||
|
||||
if args.full:
|
||||
|
||||
Reference in New Issue
Block a user