File file = new File("d:/websrc");
if(file.exists()){
if(file.isDirectory() ){
if(file.list().length<=0){
System.out.println("the directory is empty");
}else{
System.out.println("the directory is not empty");
}
}else{
System.out.println("it is not a directory");
}
}else{
System.out.println("the file is not exist");
}
if(file.exists()){
if(file.isDirectory() ){
if(file.list().length<=0){
System.out.println("the directory is empty");
}else{
System.out.println("the directory is not empty");
}
}else{
System.out.println("it is not a directory");
}
}else{
System.out.println("the file is not exist");
}
import java.io.*;public class isDirectory{
public static void main(String[] args){
File file=new File("d:/websrc");
if(file.exists()){
if(file.isDirectory()){
if(file.list().length<=0){
System.out.println("the directory is empty");
}else{
System.out.println("the directory is not empty");
}
}
else{
System.out.println("it is not a directory");
}
}
else{
System.out.println("the directory is not exist");
}
}
}