def is_subdir(child, parent):
    """
    Determine if "child" is a subdirectory of "parent".

    If child == parent, returns True.
    """
    child_path = os.path.realpath(child)
    parent_path = os.path.realpath(parent)

    if len(child_path) < len(parent_path):
        return False

    for i in range(len(parent_path)):
        if parent_path[i] != child_path[i]:
            return False

    return True
def is_subdir ( child , parent ) : child_path = os . path . realpath ( child ) parent_path = os . path . realpath ( parent ) if len ( child_path ) < len ( parent_path ) : return False for i in range ( len ( parent_path ) ) : if parent_path [ i ] != child_path [ i ] : return False return True
Determine if "child" is a subdirectory of "parent".

    If child == parent, returns True.