Here you can find the source of getAllFilesInDirectory(String path)
public static File[] getAllFilesInDirectory(String path)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { /**//from w ww. ja va 2 s .c o m * Returns the entire contents of a folder. Returns NULL if no files exist. */ public static File[] getAllFilesInDirectory(String path) { File folder = new File(path); if (folder.exists()) { return folder.listFiles(); } return null; } public static boolean exists(String path, String fileNameWithoutFullPath) { String filePath = getFileNameWithPath(path, fileNameWithoutFullPath); return exists(filePath); } public static boolean exists(String fileNameWithFullPath) { File file = new File(fileNameWithFullPath); return file.exists(); } public static String getFileNameWithPath(String path, String fileNameWithoutFullPath) { return path + File.separator + fileNameWithoutFullPath; } }