首页 > 其他 > 详细

读取固定文件夹中文件

时间:2014-12-26 02:22:59      阅读:292      评论:0      收藏:0      [点我收藏+]
读取固定文件夹中文件,本方法不适合文件夹中还有文件夹的情况

  1. String fileDirPath = 具体路径;
  2.         File root = new File(fileDirPath);
  3.         
  4.         if (!root.exists() || !root.isDirectory())
  5.         {
  6.             System.out.println("is not directory");
  7.             return isAllExists=false;
  8.         }
  9.         
  10.         File[] files = root.listFiles();
          
        /* 个性化处理 .....*/
  1.         Hashtable<String, File> htLocalFile = new Hashtable<String, File>();
  2.         for (File file : files)
  3.             htLocalFile.put(file.getName(), file);

创建文件夹方法:

  1. File root = new File(localFileDir);
  2.                         if (!root.exists())
  3.                             root.mkdirs();

参考文献:
http://blog.csdn.net/hapylong/article/details/4594130

读取固定文件夹中文件

原文:http://blog.chinaunix.net/uid-25498312-id-4712901.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!