Java tutorial
//package com.java2s; import java.io.File; import java.io.FileFilter; public class Main { static public File[] getDirectories(File file) { return file.listFiles(new FileFilter() { @Override public boolean accept(File pathname) { return pathname.isDirectory(); } }); } }