读取固定文件夹中文件,本方法不适合文件夹中还有文件夹的情况。
-
String fileDirPath = 具体路径;
-
File root = new File(fileDirPath);
-
-
if (!root.exists() || !root.isDirectory())
-
{
-
System.out.println("is not directory");
-
return isAllExists=false;
-
}
-
-
File[] files = root.listFiles();
/* 个性化处理 .....*/
-
Hashtable<String, File> htLocalFile = new Hashtable<String, File>();
-
for (File file : files)
-
htLocalFile.put(file.getName(), file);
创建文件夹方法:
-
File root = new File(localFileDir);
-
if (!root.exists())
-
root.mkdirs();
参考文献:
http://blog.csdn.net/hapylong/article/details/4594130读取固定文件夹中文件
原文:http://blog.chinaunix.net/uid-25498312-id-4712901.html