Android Directory Content Get getFilesAndSubFolderFiles(List fileList, File rootDir)

Here you can find the source of getFilesAndSubFolderFiles(List fileList, File rootDir)

Description

get Files And Sub Folder Files

Declaration

public static void getFilesAndSubFolderFiles(List<File> fileList,
            File rootDir) 

Method Source Code

//package com.java2s;
import java.io.File;

import java.util.List;

public class Main {
    public static void getFilesAndSubFolderFiles(List<File> fileList,
            File rootDir) {//  w w  w .j  a v a  2  s  .  c  o m
        if (fileList != null) {
            File[] files = rootDir.listFiles();
            if (files != null) {
                for (File file : files) {
                    if (file.isFile()) {
                        fileList.add(file);
                    } else if (file.isDirectory()) {
                        getFilesAndSubFolderFiles(fileList, file);
                    }
                }
            }
        }
    }
}

Related

  1. getFileInDirectory(File f)
  2. getFiles(File parentDir)
  3. listDirs(File file)
  4. listDirs(String fileName)
  5. listFile(File dir)
  6. listFiles(File dir)