Java File List Load getFileList(File file)

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

Description

Get complete list of files in folder

License

Open Source License

Parameter

Parameter Description
file File or Folder to scan

Return

Array of files

Declaration

public static File[] getFileList(File file) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;

public class Main {
    /**//from  w  w w .j ava 2  s  .co m
     * Get complete list of files in folder
     * @param file File or Folder to scan
     * @return Array of files
     */
    public static File[] getFileList(File file) {
        if (file.isFile() && !file.isDirectory()) {
            return new File[] { file };
        }
        return file.listFiles() != null ? file.listFiles() : new File[0];
    }
}

Related

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