Java Folder Read getFiles(File file)

Here you can find the source of getFiles(File file)

Description

Get all of the files from the direct folder

License

Apache License

Parameter

Parameter Description
file the folder

Return

file list

Declaration

public static List<File> getFiles(File file) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;

import java.util.ArrayList;

import java.util.List;

public class Main {
    /**/*from   www.j  a  v a2  s .  c  o  m*/
     * Get all of the files from the direct folder
     * 
     * @param file
     *            the folder
     * @return file list
     */
    public static List<File> getFiles(File file) {

        List<File> fileList = new ArrayList<File>();

        if (file.isDirectory()) {

            for (File child : file.listFiles()) {
                fileList.addAll(getFiles(child));
            }
        } else {
            fileList.add(file);
        }

        return fileList;
    }
}

Related

  1. getFiles(File directory)
  2. getFiles(File directory)
  3. getFiles(File directory)
  4. getFiles(File directory)
  5. getFiles(File f, List response)
  6. getFiles(File file, Collection ret)
  7. getFiles(File folder)
  8. getFiles(File folder)
  9. getFiles(File folder)