Added ability to define output directory

This commit is contained in:
2026-02-02 22:00:08 +00:00
parent a0e7a494e4
commit 1a7be7fddf
3 changed files with 111 additions and 1 deletions
+5 -1
View File
@@ -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: