Here you can find the source of getAllFileName(String path, ArrayList
Parameter | Description |
---|---|
path | a parameter |
fileName | a parameter |
public static void getAllFileName(String path, ArrayList<String> fileName)
//package com.java2s; //License from project: Apache License import java.io.*; import java.util.*; public class Main { /**/* w w w. j a v a 2 s. co m*/ * get filenames with sub-directory * @param path * @param fileName */ public static void getAllFileName(String path, ArrayList<String> fileName) { File file = new File(path); File[] files = file.listFiles(); String[] names = file.list(); if (names != null) { fileName.addAll(Arrays.asList(names)); } for (File a : files) { if (a.isDirectory()) { getAllFileName(a.getAbsolutePath(), fileName); } } } }