public class TestUrl {
public static void main(String[] args) {
String pageName = "ogr.test";//包路径
fileRecursive(pageName);
}
public static void fileRecursive(String pageName) {
URL url = Thread.currentThread().getClass().getResource("/" + pageName.replaceAll("\.", "/"));//把/代替成.
File file = new File(url.getFile());
for(File tempFile: file.listFiles()){
if(tempFile.isDirectory()){
fileRecursive(pageName+"."+tempFile.getName());
}else{
System.out.println(pageName+"."+tempFile.getName());
}
}
}
}