if (mLog.isInfoEnabled()) mLog.info("directory " + optDirectory + " does not exist, will create");
mLog.info("Creating directory: " + optDirectory);
    public static void main(String[] args) throws ServiceException, HttpException, SoapFaultException, IOException {        CommandLine cl = parseArgs(args);        if (cl.hasOption('D')) {            Zimbra.toolSetup("DEBUG");        } else if (cl.hasOption('v')) {            Zimbra.toolSetup("INFO");        } else {            Zimbra.toolSetup("WARN");        }                if (cl.hasOption('s') && cl.hasOption('n')) {            usage("specify only one of spam or notspam options");        }        if (!cl.hasOption('s') && !cl.hasOption('n')) {            usage("must specify one of spam or notspam options");        }        boolean optSpam = true;        if (cl.hasOption('n')) {            optSpam = false;        } else if (cl.hasOption('s')) {            optSpam = true;        }        boolean optKeep = cl.hasOption('k');        if (!cl.hasOption('d')) {            usage("must specify directory to extract messages to");        }        String optDirectory = cl.getOptionValue('d');        File dir = new File(optDirectory);        if (!dir.exists()) {            if (mLog.isInfoEnabled()) mLog.info("directory " + optDirectory + " does not exist, will create");            dir.mkdirs();            if (!dir.exists()) {                mLog.error("could not create directory " + optDirectory);                System.exit(2);            }        }        if (mLog.isInfoEnabled()) mLog.info("Extracting type: " + (optSpam ? "spam" : "ham"));                Account spamAccount = getSpamAccount(optSpam);        if (spamAccount == null) {            System.exit(1);        }                if (mLog.isInfoEnabled()) mLog.info("Configured account: " + spamAccount.getName());                Server server = spamAccount.getServer();        String adminAuthToken = getAdminAuthToken(server);        LmcSession session = new LmcSession(adminAuthToken, null);        extract(adminAuthToken, spamAccount, server, "inbox", dir);    }