Java Folder Read getFiles(String paths)

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

Description

get Files

License

Apache License

Declaration

private static List<File> getFiles(String paths) 

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 {
    private static List<File> getFiles(String paths) {
        List<File> filesList = new ArrayList<>();
        for (final String path : paths.split(File.pathSeparator)) {
            final File file = new File(path);
            if (file.isDirectory()) {
                recurse(filesList, file);
            } else {
                filesList.add(file);// w ww  .j av a2  s  .  com
            }
        }
        return filesList;
    }

    private static void recurse(List<File> filesList, File f) {
        File list[] = f.listFiles();
        for (File file : list) {
            if (file.isDirectory()) {
                recurse(filesList, file);
            } else {
                filesList.add(file);
            }
        }
    }
}

Related

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