public static void getFolderAllFiles(File dir, List<String> filenameList)
{
if (dir.isDirectory() && dir.canRead() && dir.canWrite())
{
File[] allfiles = dir.listFiles( new FileFilter()
{
public boolean accept(File pathname)
{
if (pathname.canRead() )
return true;
else
return false;
}
});
for(File file : allfiles)
{
if ( file.isFile() ) {
filenameList.add(file.getPath());
} else {
getFolderAllFiles(file, filenameList);
}
}
}
}
获取目录下所有文件名称(带路径)
最新推荐文章于 2024-07-12 16:51:00 发布