Here you can find the source of GetFilesWithChildren(File root, ArrayList
Parameter | Description |
---|---|
root | a parameter |
files | a parameter |
public static ArrayList<String> GetFilesWithChildren(File root, ArrayList<String> files)
//package com.java2s; //License from project: Apache License import java.io.File; import java.util.ArrayList; public class Main { /**//from w ww . j ava2 s. co m * Gets all files with child directory * @param root * @param files * @return all files with absolutePath */ public static ArrayList<String> GetFilesWithChildren(File root, ArrayList<String> files) { File[] list = root.listFiles(); if (list == null) return files; for (File p : list) { if (p.isDirectory()) { GetFilesWithChildren(p, files); } else { files.add(p.getAbsolutePath()); } } return files; } }