get get file from directory java code example
Example 1: java get files in directory
File folder = new File("/Users/you/folder/");
File[] listOfFiles = folder.listFiles();
for (File file : listOfFiles) {
if (file.isFile()) {
System.out.println(file.getName());
}
}
Example 2: get file path java
File file = new File("yourfileName");
String path = file.getAbsolutePath();