    if (findHandle == INVALID_HANDLE_VALUE || !isDir) {

        WLOG(WS_LOG_SFTP, "Error with opening directory");
        WFREE(dirName, ssh->ctx->heap, DYNTYPE_BUFFER);

        if (wolfSSH_SFTP_CreateStatus(ssh, WOLFSSH_FTP_NOFILE, reqId,
                "Unable To Open Directory", "English", NULL, &outSz)
                != WS_SIZE_ONLY) {
                return WS_FATAL_ERROR;
        }
        ret = WS_BAD_FILE_E;
    }
    if (findHandle == INVALID_HANDLE_VALUE || !isDir) {

        WLOG(WS_LOG_SFTP, "Error with opening directory");
        WFREE(dirName, ssh->ctx->heap, DYNTYPE_BUFFER);

        if (wolfSSH_SFTP_CreateStatus(ssh, WOLFSSH_FTP_NOFILE, reqId,
                "Unable To Open Directory", "English", NULL, &outSz)
                != WS_SIZE_ONLY) {
                return WS_FATAL_ERROR;
        }
        ret = WS_BAD_FILE_E;
    }