Java tutorial
import java.io.File; import java.io.FileFilter; import java.io.FilenameFilter; public class Main { public static void main(String[] argv) throws Exception { File dir = new File("c:\\temp"); FileFilter fileFilter = new FileFilter() { public boolean accept(File file) { return file.isDirectory(); } }; File[] files = dir.listFiles(fileFilter); } }