zhyiwww
          用平實的筆,記錄編程路上的點點滴滴………
          posts - 536,comments - 394,trackbacks - 0
          <2006年6月>
          28293031123
          45678910
          11121314151617
          18192021222324
          2526272829301
          2345678

          -------------------------------------------
          崇尚原創精神,
          文章歡迎轉載,
          請您注明出處,
          在此特別聲明。
          版權所有@zhyiwww
          引用鏈接
          http://www.aygfsteel.com/zhyiwww

          --------------------------------------------

          常用鏈接

          留言簿(33)

          隨筆分類(626)

          朋友的博客

          最新隨筆

          搜索

          •  

          積分與排名

          • 積分 - 1561095
          • 排名 - 11

          最新評論

          閱讀排行榜

          評論排行榜

          This example lists the files and subdirectories in a directory. To list all descendant files and subdirectories under a directory, see e33 Traversing the Files and Directories Under a Directory .

          				
          						File dir = new File("directoryName");
              
              String[] children = dir.list();
              if (children == null) {
                  // Either dir does not exist or is not a directory
              } else {
                  for (int i=0; i<children.length; i++) {
                      // Get filename of file or directory
                      String filename = children[i];
                  }
              }
              
              // It is also possible to filter the list of returned files.
              // This example does not return any files that start with `.'.
              FilenameFilter filter = new FilenameFilter() {
                  public boolean accept(File dir, String name) {
                      return !name.startsWith(".");
                  }
              };
              children = dir.list(filter);
              
              
              // The list of files can also be retrieved as File objects
              File[] files = dir.listFiles();
              
              // This filter only returns directories
              FileFilter fileFilter = new FileFilter() {
                  public boolean accept(File file) {
                      return file.isDirectory();
                  }
              };
              files = dir.listFiles(fileFilter);
          				
          		


          |----------------------------------------------------------------------------------------|
                                     版權聲明  版權所有 @zhyiwww
                      引用請注明來源 http://www.aygfsteel.com/zhyiwww   
          |----------------------------------------------------------------------------------------|
          posted on 2006-06-13 11:45 zhyiwww 閱讀(302) 評論(0)  編輯  收藏 所屬分類: code demo -java
          主站蜘蛛池模板: 贺兰县| 莎车县| 黄骅市| 宁德市| 洛扎县| 繁峙县| 辽中县| 水城县| 新野县| 武定县| 平潭县| 泸定县| 宽城| 九龙坡区| 江华| 成安县| 乌兰浩特市| 随州市| 确山县| 禹城市| 三明市| 福建省| 靖宇县| 宜兰县| 同仁县| 古丈县| 潜山县| 河北省| 靖边县| 江口县| 辽中县| 潮州市| 介休市| 新化县| 温泉县| 桦川县| 浦县| 布尔津县| 清徐县| 勃利县| 杭锦后旗|