Here you can find the source of getFileNameUtil(String dataPath)
public static ArrayList<String> getFileNameUtil(String dataPath)
//package com.java2s; //License from project: Apache License import java.io.File; import java.util.ArrayList; public class Main { public static ArrayList<String> getFileNameUtil(String dataPath) { ArrayList<String> fileName = new ArrayList<>(); File file = new File(dataPath); File[] files = file.listFiles(); if (files != null) { for (File file1 : files) { if (file1.isDirectory()) { getFileNameUtil(file1.getPath()); } else { fileName.add(file1.getName()); }//from w ww . j a v a2s. c o m } } return fileName; } }