Here you can find the source of getAllFile(List
Parameter | Description |
---|---|
list | a parameter |
rootFile | a parameter |
public static List<File> getAllFile(List<File> list, File rootFile)
//package com.java2s; import java.io.File; import java.util.Arrays; import java.util.List; public class Main { /**//from ww w. j av a 2s. co m * recursively get the file list. * * @param list * @param rootFile * @return */ public static List<File> getAllFile(List<File> list, File rootFile) { if (rootFile.getAbsolutePath().indexOf(".svn") < 0) { list.add(rootFile); if (rootFile.isDirectory()) { File[] files = rootFile.listFiles(); Arrays.sort(files); for (File file : files) { getAllFile(list, file); } } } return list; } /** * determine if the file is directory . * * @param path * @return */ public static boolean isDirectory(String path) { return new File(path).isDirectory(); } }