Here you can find the source of getAllFiles(File outputDir, List
private static void getAllFiles(File outputDir, List<File> files)
//package com.java2s; import java.io.File; import java.io.FileFilter; import java.util.List; public class Main { private static void getAllFiles(File outputDir, List<File> files) { File[] fileList = outputDir.listFiles(new FileFilter() { public boolean accept(File pathname) { if (pathname.getName().endsWith(".class") || pathname.isDirectory()) return true; return false; }//w w w. ja va2 s. c o m }); for (File file : fileList) { if (file.isDirectory()) { getAllFiles(file, files); } else files.add(file); } } }