Java tutorial
//package com.java2s; // %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt import java.io.File; import java.util.List; public class Main { /** * DOC bZhou Comment method "searchAllFile". * * @param result * @param parent * @param recursive * @param withFolder */ public static void searchAllFile(List<File> result, File parent, boolean recursive, boolean withFolder) { File[] files = parent.listFiles(); if (files != null) { for (File file : files) { if (file.isDirectory() && recursive) { if (withFolder) { result.add(file); } searchAllFile(result, file, recursive, withFolder); } else { result.add(file); } } } else { result.add(parent); } } }