Java Directory to File List getAllFiles(File input)

Here you can find the source of getAllFiles(File input)

Description

get All Files

License

Apache License

Declaration

public static List<File> getAllFiles(File input) 

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 {
    public static List<File> getAllFiles(File input) {
        ArrayList<File> a = new ArrayList<>();

        if (!input.isDirectory()) {
            a.add(input);/* ww w .  j  a v  a  2  s . c  om*/
            return a;
        }

        for (File f : input.listFiles()) {
            a.addAll(getAllFiles(f));
        }
        return a;
    }
}

Related

  1. getAllFiles(File directory)
  2. getAllFiles(File directory)
  3. getAllFiles(File directory, boolean hidden)
  4. getAllFiles(File directory, String rootPath)
  5. getAllFiles(File inFileOrDir, boolean recurseDir)
  6. getAllFiles(File outputDir, List files)
  7. getAllFiles(File path, List fileList, boolean recursive)
  8. getAllFiles(File root, FileFilter fileFilter)
  9. getAllFiles(File rootDirectory, FileFilter fileFilter, boolean includeSubdirectories)