遍历文件夹~~~包含子目录
ArrayList<String> filelist = new ArrayList<String>();
/**
* 遍历文件夹 获取全部本地文件名
* @param localPath
*/
public void refreshFileList(String localPath)
{
File dir = new File(localPath);
File[] files = dir.listFiles();
if (files == null)
return;
for (int i = 0; i < files.length; i++)
{
if (files[i].isDirectory())
{
refreshFileList(files[i].getAbsolutePath());
}
else
{
filelist.add(files[i].getName());
}
}
}
网友评论