[fs2zammad] allow arbitrary source directory as CLI arg
This commit is contained in:
parent
2d3526918e
commit
230d8703ff
1 changed files with 9 additions and 2 deletions
11
fs2zammad
11
fs2zammad
|
@ -303,14 +303,21 @@ with open("rt2zammad.json") as handle:
|
||||||
h2t = html2text.HTML2Text()
|
h2t = html2text.HTML2Text()
|
||||||
zammad = get_zammad_session()
|
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("users", exist_ok=True)
|
||||||
os.makedirs("tickets", exist_ok=True)
|
os.makedirs("tickets", exist_ok=True)
|
||||||
os.makedirs("attachments", exist_ok=True)
|
os.makedirs("attachments", exist_ok=True)
|
||||||
os.makedirs("failed", exist_ok=True)
|
os.makedirs("failed", exist_ok=True)
|
||||||
os.makedirs("processed", exist_ok=True)
|
os.makedirs("processed", exist_ok=True)
|
||||||
|
|
||||||
ticket_ids = os.listdir("tickets/")
|
ticket_ids = os.listdir(source_directory)
|
||||||
print(f"Found {len(ticket_ids)} tickets on filesystem.")
|
print(f"Found {len(ticket_ids)} tickets on filesystem (source directory: {source_directory})")
|
||||||
ticket_ids = list(map(int, ticket_ids))
|
ticket_ids = list(map(int, ticket_ids))
|
||||||
ticket_ids.sort()
|
ticket_ids.sort()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue