public String[] filesInDir(String dirName){
String[] files = null;
try {
File dir = new File(dirName);
if (dir.isDirectory()) {
files = dir.list();
}
else if (!dir.exists()){
System.out.println("Directory doesn't exist");
System.exit(0);
}
} catch (Exception e) {
e.printStackTrace();
}
return files;
}
String[] files = null;
try {
File dir = new File(dirName);
if (dir.isDirectory()) {
files = dir.list();
}
else if (!dir.exists()){
System.out.println("Directory doesn't exist");
System.exit(0);
}
} catch (Exception e) {
e.printStackTrace();
}
return files;
}
No comments:
Post a Comment