diff --git a/fs2zammad b/fs2zammad index 8b590c7..dc08171 100755 --- a/fs2zammad +++ b/fs2zammad @@ -303,14 +303,21 @@ with open("rt2zammad.json") as handle: h2t = html2text.HTML2Text() zammad = get_zammad_session() +source_directory = "tickets/" +if len(sys.argv) >= 2: + source_directory = sys.argv[1] +if not os.path.isdir(source_directory): + print(f"Could not find source directory {source_directory}. Exiting.") + sys.exit(1) + os.makedirs("users", exist_ok=True) os.makedirs("tickets", exist_ok=True) os.makedirs("attachments", exist_ok=True) os.makedirs("failed", exist_ok=True) os.makedirs("processed", exist_ok=True) -ticket_ids = os.listdir("tickets/") -print(f"Found {len(ticket_ids)} tickets on filesystem.") +ticket_ids = os.listdir(source_directory) +print(f"Found {len(ticket_ids)} tickets on filesystem (source directory: {source_directory})") ticket_ids = list(map(int, ticket_ids)) ticket_ids.sort()