Here you can find the source of GetAllFileName(String path)
public static List<String> GetAllFileName(String path)
//package com.java2s; //License from project: Apache License import java.io.*; import java.util.*; public class Main { public static List<String> GetAllFileName(String path) { List<String> arrList = new ArrayList<String>(); File file = new File(path); if (!file.exists()) { return arrList; }//from ww w . j a v a 2s. co m if (!file.isDirectory()) { return arrList; } String[] tempList = file.list(); File temp; for (String aTempList : tempList) { if (path.endsWith(File.separator)) { temp = new File(path + aTempList); } else { temp = new File(path + File.separator + aTempList); } if (temp.isFile()) { arrList.add(temp.getName()); } } return arrList; } }