def checkArgs(args):
    """Checks the arguments and options.

    :param args: an object containing the options of the program.

    :type args: argparse.Namespace

    :returns: ``True`` if everything was OK.

    If there is a problem with an option, an exception is raised using the
    :py:class:`ProgramError` class, a message is printed to the
    :class:`sys.stderr` and the program exists with code 1.

    """
    # For all input directories
    for dn in args.qc_dir:
        # Checking that all the directories exists
        if not os.path.isdir(dn):
            raise ProgramError("{}: no such directory".format(dn))

        # Checking that this is a directory created from pyGenClean
        if not os.path.basename(dn.rstrip("/")).startswith("data_clean_up."):
            raise ProgramError("{}: not a pyGenClean directory".format(dn))

        # Checking that each directory contains the required files
        for fn in ("excluded_markers.txt", "excluded_samples.txt",
                   "results_summary.txt", "steps_summary.tex",
                   "initial_files.txt", "final_files.txt"):
            required_fn = os.path.join(dn, fn)
            if not os.path.isfile(required_fn):
                raise ProgramError("{}: missing required "
                                   "file".format(required_fn))

    return True