Java Directory to File List getAllFileName(String path, ArrayList fileName)

Here you can find the source of getAllFileName(String path, ArrayList fileName)

Description

get filenames with sub-directory

License

Apache License

Parameter

Parameter Description
path a parameter
fileName a parameter

Declaration

public static void getAllFileName(String path, ArrayList<String> fileName) 

Method Source Code

//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);
            }
        }
    }
}

Related

  1. getAllFile(List list, File rootFile)
  2. getAllFile2(String Url)
  3. getAllFileFromPath(File file, List fileList, String ed)
  4. getAllFileName(String path)
  5. GetAllFileName(String path)
  6. getAllFileNames(File basedir, String path)
  7. getAllFileNames(String path, String suffix, boolean isDepth)
  8. getAllFileNamesByPath(String path)
  9. getAllFileNamesInDir(String folderName)