Java Directory to File List getAllFilesPresentInFolder(File srcPath)

Here you can find the source of getAllFilesPresentInFolder(File srcPath)

Description

get All Files Present In Folder

License

Apache License

Declaration

public static List getAllFilesPresentInFolder(File srcPath) 

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 getAllFilesPresentInFolder(File srcPath) {
        List fileList = new ArrayList();
        if (srcPath.isDirectory()) {
            String files[] = srcPath.list();
            for (int i = 0; i < files.length; i++) {
                fileList.addAll(getAllFilesPresentInFolder(new File(srcPath, files[i])));
            }/*from  ww  w. j av a2s  . co m*/
        } else {
            fileList.add(srcPath.getAbsolutePath());
        }
        return fileList;
    }
}

Related

  1. getAllFilesInSubFolder(String base, String ending)
  2. getAllFilesInternal(final File aPath, final FilenameFilter filter, final List fileList)
  3. getAllFilesLeastRecentFirst(File directory)
  4. getAllFilesMatching(File srcDir, final String regex)
  5. getAllFilesMatchingThisPatternIgnoreCase(String sDirectoryPath, String sPattern)
  6. getAllFilesRecursively(File dir, List filelist)
  7. getAllFilesRecursively(File directory, Collection files)
  8. getAllFilesWithExtension(String directory, final String extension)
  9. getAllFilesWithExtension(String folderPath, String extension)