Here you can find the source of getAllFilesInternal(final File aPath, final FilenameFilter filter, final List
private static void getAllFilesInternal(final File aPath, final FilenameFilter filter, final List<File> fileList)
//package com.java2s; /******************************************************************************* * Copyright (c) 005, 2007, 2008 committers of openArchitectureWare and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://from w w w.j a v a2s . c o m * committers of openArchitectureWare - initial API and implementation *******************************************************************************/ import java.io.File; import java.io.FilenameFilter; import java.util.List; public class Main { private static void getAllFilesInternal(final File aPath, final FilenameFilter filter, final List<File> fileList) { final File[] allFiles = aPath.listFiles(filter); for (int i = 0; i < allFiles.length; i++) { if (allFiles[i].isDirectory()) getAllFilesInternal(allFiles[i], filter, fileList); else fileList.add(allFiles[i]); } } }