Java Folder Read getFilesFromClassPath(String classpath)

Here you can find the source of getFilesFromClassPath(String classpath)

Description

get Files From Class Path

License

Apache License

Declaration

public static List<File> getFilesFromClassPath(String classpath) 

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> getFilesFromClassPath(String classpath) {
        File dir = new File(classpath);
        return getFilesFromDir(dir);
    }//from  w ww.j  ava  2 s  .c o m

    public static List<File> getFilesFromDir(File dir) {
        List<File> files = new ArrayList<File>();
        for (File f : dir.listFiles()) {
            if (!dir.exists())
                continue;
            if (f.isDirectory()) {
                List<File> _files = getFilesFromDir(f);
                files.addAll(_files);
                continue;
            }

            files.add(f);
        }

        return files;
    }
}

Related

  1. getFilesFolder(String path)
  2. getFilesFor(List patientSets, File inputDirectory)
  3. getFilesForDirectory(File dir)
  4. getFilesForFolder(File folder)
  5. getFilesForPattern(String pathToScan, String startWith, String endsWith)
  6. getFilesFromDiskWorker(File folderToLoad, final String searchPattern, final boolean justFolders)
  7. getFileSimpleName(final File f)
  8. getFilesInClassPath(String path, String endsWith)
  9. getFilesIncludeSubdirectories(final File directory)