Java tutorial
//package com.java2s; import java.io.File; import java.io.FileFilter; public class Main { /** * Resource directory name that we are looking for. */ protected static final String RESOURCE_DIR_NAME = "res"; /** * Raw directory name that we are looking for. */ protected static final String RAW_DIR_NAME = "raw"; /** * Look for the resource directory with raw beneath it. */ private static File findResRawDir(File dir) { for (File file : dir.listFiles()) { if (file.getName().equals(RESOURCE_DIR_NAME) && file.isDirectory()) { File[] rawFiles = file.listFiles(new FileFilter() { public boolean accept(File file) { return file.getName().equals(RAW_DIR_NAME) && file.isDirectory(); } }); if (rawFiles.length == 1) { return rawFiles[0]; } } } return null; } }