Skip to content

check_directory_exists

Checks if the directory of a given file path exists.

Parameters:

Name Type Description Default
complete_file_path str

The full file path whose directory needs to be checked.

required

Returns:

Type Description
bool

True if the directory exists, False otherwise.

Source code in tinybig/util/utility.py
def check_directory_exists(complete_file_path):
    """
    Checks if the directory of a given file path exists.

    Parameters
    ----------
    complete_file_path : str
        The full file path whose directory needs to be checked.

    Returns
    -------
    bool
        True if the directory exists, False otherwise.
    """
    directory_path = os.path.dirname(complete_file_path)
    return os.path.exists(directory_path)