Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.File; import java.util.ArrayList; public class Main { public static ArrayList<File> getFilesInPath(String path) { File pathFile = new File(path); if (pathFile != null) { File[] files = pathFile.listFiles(); ArrayList<File> result = new ArrayList<>(); for (int i = 0; i < files.length; ++i) { result.add(files[i]); } result.add(0, pathFile.getParentFile()); return result; } else { return null; } } }