Java File List Load getFileList(File f)

Here you can find the source of getFileList(File f)

Description

Gets a list of files in the specified dir.

License

LGPL

Parameter

Parameter Description
f the dir to traverse

Return

the list of files

Declaration

public static List<File> getFileList(File f) 

Method Source Code


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

import java.io.*;

import java.util.ArrayList;

import java.util.List;

public class Main {
    /**/*from ww w .java2s . co  m*/
     * Gets a list of files in the specified dir. Note: Non-recursive, no dirs included
     * @param f the dir to traverse
     * @return the list of files
     */
    public static List<File> getFileList(File f) {
        List<File> fileList = new ArrayList<File>();
        File[] files = f.listFiles();
        if (files != null) {
            for (File file : files) {
                if (!file.isDirectory())
                    fileList.add(file);
            }
        }
        return fileList;
    }
}

Related

  1. getFileList(File dir, ArrayList list)
  2. getFileList(File dir, Set arrayList)
  3. getFileList(File dir, String regex)
  4. getFileList(File dirFile, final String filenamePrefix)
  5. getFileList(File f, FileFilter filter, boolean recursive, boolean wantDirectory, boolean wantHidden, ArrayList list)
  6. getFileList(File file)
  7. getFileList(File file)
  8. getFileList(File file, String[] suffixs)