Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6075086
  • 博文数量: 2759
  • 博客积分: 1021
  • 博客等级: 中士
  • 技术积分: 4091
  • 用 户 组: 普通用户
  • 注册时间: 2012-03-11 14:14
文章分类

全部博文(2759)

文章存档

2019年(1)

2017年(84)

2016年(196)

2015年(204)

2014年(636)

2013年(1176)

2012年(463)

分类: Java

2014-12-28 11:27:50

原文地址:读取固定文件夹中文件 作者:dyli2000

读取固定文件夹中文件,本方法不适合文件夹中还有文件夹的情况

  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
阅读(895) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~