如何用递归获取一个文件夹内的所有文件存放在一个文件数组中?

[复制链接]
查看11 | 回复2 | 2017-11-25 23:16:47 | 显示全部楼层 |阅读模式
public static void main(String[] args) throws Exception {File dir = new File("F:\\jk\\yy-5");List files = getAllFiles(dir);//转换成数组File[] fileArr = new File[]{};fileArr = files.toArray(fileArr);for(File file:fileArr){System.out.println(file);}}public static List getAllFiles(File dir) throws Excepti...
回复

使用道具 举报

千问 | 2017-11-25 23:16:47 | 显示全部楼层
ArrayList filelist=refreshFileList("路径",new ArrayList());
public ArrayList refreshFileList(String strPath,ArrayList filelist) {
//遍历指定目...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行