isDirectory

Checks if the file located by this path is a directory.

inline fun Path.isDirectory(vararg options: LinkOption): Boolean(source)
import java.nio.file.Paths
import kotlin.io.path.isDirectory

fun main() {
    val path = Paths.get("src")

    if (path.isDirectory()) {
        println("$path is a directory")
    } else {
        println("$path is not a directory")
    }
}

Source