public class Solution { private static final String THIS_IS_FILE = " - это файл"; private static final String THIS_IS_DIR = " - это директория"; public static void main(String[] args) throws IOException { Scanner console = new Scanner(System.in); System.out.println("Please provide the directory path: "); Path directory = Path.of(console.nextLine()); try (DirectoryStream<Path> paths = Files.newDirectoryStream(directory)) { for (Path path : paths) { if (Files.isRegularFile(path)) { System.out.println(path.toString() + THIS_IS_FILE); } else if (Files.isDirectory(path)) { System.out.println(path.toString() + THIS_IS_DIR ); } } } } }