public static void listDirectory(File dir) throws IOException{
if(!dir.exists()) {
System.out.println("目录:" +dir + "不存在");
throw new IllegalArgumentException();
}
String[] files = dir.list();
if(files.length > 0 && files != null){
for (String string : files) {
if(new File(dir + "\\" + string).isDirectory()) {
listDirectory(new File(dir + "\\" + string));
}else {
System.out.println(dir + "\\" + string);
}
}
}