File theDir = new File ("New Folder");
// If the directory does not exist, create the directory.
if (!theDir.exists()) {
System.out.println("creating directory: " + directoryName);
boolean result = false;
try{
theDir.mkdir();
result = true;
}
catch(SecurityException se){
//handle it
}
if(result) {
System.out.println("DIR created");
}
}
You can do it like this.
© 2024 OneMinuteCode. All rights reserved.