标签:blog ar java for 文件 2014 log ad as
/** * 列出目录下的所有文件 * * @param directory * @return */ public List<File> listFile(File directory) { List<File> list = new ArrayList<File>(); if (!directory.exists()) return list; if (directory.isDirectory()) { File[] files = directory.listFiles(); for (File file : files) { if (file.isFile()) { list.add(file); } else if (file.isDirectory()) { list.addAll(listFile(file)); } } } return list; }
标签:blog ar java for 文件 2014 log ad as
原文地址:http://blog.csdn.net/hackcoder/article/details/41513127