def folder_to_db(path, session, method='create', autocommit=False, incl_pot=True):
    """
    Import an entire folder (incl. sub-folders) into the database

    :param path: Folder location
    :type path: str
    :param session: database session to use, typically `floodestimation.db.Session()`
    :type session: :class:`sqlalchemy.orm.session.Session`
    :param method: - ``create``: only new catchments will be loaded, it must not already exist in the database.
                   - ``update``: any existing catchment in the database will be updated. Otherwise it will be created.
    :type method: str
    :param autocommit: Whether to commit the database session immediately. Default: ``False``.
    :type autocommit: bool
    :param incl_pot: Whether to load the POT (peaks-over-threshold) data. Default: ``True``.
    :type incl_pot: bool
    """
    if not os.path.isdir(path):
        raise ValueError("Folder `{}` does not exist or is not accesible.".format(path))

    cd3_files = [os.path.join(dp, f) for dp, dn, filenames in os.walk(path)
                 for f in filenames if os.path.splitext(f)[1].lower() == '.cd3']
    for cd3_file_path in cd3_files:
        catchment = from_file(cd3_file_path, incl_pot)
        to_db(catchment, session, method)
    if autocommit:
        session.commit()