public boolean isFileOrDirectoryPresent(String fileOrDirName){
File file = new File(fileOrDirName);
if (!file.exists()){
System.out.println("File/Directory doesn't exist");
return false;
}
else {
System.out.println("File/Directory exists");
return true;
}
}
File file = new File(fileOrDirName);
if (!file.exists()){
System.out.println("File/Directory doesn't exist");
return false;
}
else {
System.out.println("File/Directory exists");
return true;
}
}
No comments:
Post a Comment