Java Directory to File List getAllFiles(File dir, List fileList)

Here you can find the source of getAllFiles(File dir, List fileList)

Description

get All Files

License

Open Source License

Declaration

public static void getAllFiles(File dir, List<File> fileList) throws IOException 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) [2012] - [2016] Codenvy, S.A.
 * 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://  ww w .j av  a2 s .  c  o m
 *   Codenvy, S.A. - initial API and implementation
 *******************************************************************************/

import java.io.File;

import java.io.IOException;

import java.util.List;

public class Main {
    public static void getAllFiles(File dir, List<File> fileList) throws IOException {
        File[] files = dir.listFiles();
        for (File file : files) {
            fileList.add(file);
            if (file.isDirectory()) {
                getAllFiles(file, fileList);
            }
        }
    }
}

Related

  1. getAllFileNamesWithExtension(String directory, final String extension)
  2. getAllFilePath(String filedir)
  3. getAllFiles(File dir)
  4. getAllFiles(File dir)
  5. getAllFiles(File dir, List fileList)
  6. getAllFiles(File dir, Pattern filter)
  7. getAllFiles(File directory)
  8. getAllFiles(File directory)
  9. getAllFiles(File directory, boolean hidden)