From b6274e31f7ce60112dc96bfb48590d541a37b388 Mon Sep 17 00:00:00 2001 From: Clinton Hall Date: Fri, 1 Mar 2013 14:28:59 -0800 Subject: [PATCH] added create_destination --- nzbToMediaUtil.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/nzbToMediaUtil.py b/nzbToMediaUtil.py index ee62e4ac..33698353 100644 --- a/nzbToMediaUtil.py +++ b/nzbToMediaUtil.py @@ -1,6 +1,6 @@ import logging import logging.config -import os.path +import os import sys @@ -13,6 +13,16 @@ def nzbtomedia_configure_logging(dirname): logging.getLogger().addHandler(fileHandler) +def create_destination(outputDestination): + if not os.path.exists(outputDestination): + try: + Logger.info("CREATE DESTINATION: Creating destination folder: %s", outputDestination) + os.makedirs(outputDestination) + except Exception, e: + Logger.error("CREATE DESTINATION: Not possible to create destination folder: %s. Exiting", e) + sys.exit(-1) + + def parse_other(args): return os.path.normpath(sys.argv[1]), '', '', ''