검색결과 리스트
글
package util;
import java.io.File;
public class ShowFileList {
public static void main(String[] args) throws Exception {
try {
String dir = "D";//
(new ShowFileList()).showFileList(dir);
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void showFileList(String path) throws Exception {
File dir = new File(path);
File[] files = dir.listFiles();
for (int i = 0; i < files.length; i++) {
File file = files[i];
if (file.isFile()) {
String strFileName = file.getCanonicalPath().toString().toLowerCase();
if( strFileName.indexOf(".svn") == -1 && (strFileName.indexOf(".java") > -1 || strFileName.indexOf(".xml") > -1) )
System.out.println("[File]"+file.getCanonicalPath().toString().replace("\\", "/").replace(".java", ".class"));
} else if (file.isDirectory()) {
// System.out.println("[Directory]"+file.getCanonicalPath().toString());
try {
showFileList(file.getCanonicalPath().toString());
} catch (Exception e) {
}
}
}
}
}
RECENT COMMENT