How to iterate over the files of a certain directory, in Java? [duplicate]
If you have the directory name in myDirectoryPath, import java.io.File; … File dir = new File(myDirectoryPath); File[] directoryListing = dir.listFiles(); if (directoryListing != null) { for (File child : directoryListing) { // Do something with child } } else { // Handle the case where dir is not really a directory. // Checking dir.isDirectory() above … Read more