Java Folder Read getFiles(String rootDirectory)

Here you can find the source of getFiles(String rootDirectory)

Description

get Files

License

Open Source License

Declaration

public static List<String> getFiles(String rootDirectory) 

Method Source Code


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

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class Main {
    public static List<String> getFiles(String rootDirectory) {

        File[] files = new File(rootDirectory).listFiles();
        List<String> result = new ArrayList();
        for (File file : files) {
            if (!file.isDirectory()) {
                result.add(file.getAbsolutePath());
                // System.out.println("File:" + file.getAbsolutePath());
            } else if (file.isDirectory()) {
                // System.out.println("Dir:" + file.getAbsolutePath());
                result.addAll(getFiles(file.getAbsolutePath()));
            }/*from  www  .  ja v a  2s.com*/
        }
        return result;
    }
}

Related

  1. getFiles(String path)
  2. getFiles(String path, final String suffix)
  3. getFiles(String path, String endian)
  4. getFiles(String paths)
  5. getFiles(String realpath, List files, String[] fileType)
  6. getFiles(String thePaths[])
  7. getFilesAndFilesSubDirectories(String directoryName, String regexPattern)
  8. getFilesArray(File baseStorePath, final String fileNameSearchPattern)
  9. getFilesAsArrayList(String path)