Hi All,
You can use below code to read files from specific folders :
You can use below code to read files from specific folders :
import java.io.File;
public class Test {
/**
* @param args
*/
public static void listFilesForFolder(File folder) {
for (File fileEntry : folder.listFiles()) {
if (fileEntry.isDirectory()) {
listFilesForFolder(fileEntry);
} else {
System.out.println(fileEntry.getName());
}
}
System.out.println("Total :" +folder.listFiles().length);
}
public static void main(String[] args) {
final File folder = new File("C:/Users/jignesh.vachhani/Desktop/Jignesh");
listFilesForFolder(folder);
}
}