if string is a folder path ubuntu code example Example: java check if directory exists Path path = ...; if (Files.exists(path)) { // ... }