字體:小 中 大 |
|
|
|
| 2008/06/06 16:31:44瀏覽16066|回應0|推薦0 | |
| /** * 輸入資料夾的路徑, 顯示得該資料夾下的所有檔案 * @param String folderPath * @author Lupin **/ public void getFileList(String folderPath){ //String folderPath = "C:\\";//資料夾路徑 StringBuffer fileList = new StringBuffer(); try{ java.io.File folder = new java.io.File(folderPath); String[] list = folder.list(); for(int i = 0; i < list.length; i++){ fileList.append(list[i]).append(", "); } }catch(Exception e){ System.out.println("'"+folderPath+"'此資料夾不存在"); } System.out.println(fileList); } } |
|
| ( 知識學習|其他 ) |











