import java.io.File; public class ListFilesFromDirectory { public static void main(String[] args) { String sDirectoryPath = "mydirectorypath"; File oDirectory = new File(sDirectoryPath); if(oDirectory.isDirectory()) { File[] aFiles = oDirectory.listFiles(); for(int i=0; i<aFiles.length; i++) { System.out.println(aFiles[i].getPath()); } } else { System.out.println(sDirectoryPath+" is not a directory."); } } }