Skip to content

Instantly share code, notes, and snippets.

@nboubakr
Created February 20, 2014 13:56
Show Gist options
  • Save nboubakr/9114097 to your computer and use it in GitHub Desktop.
Save nboubakr/9114097 to your computer and use it in GitHub Desktop.
This function allows you to create a directory on the user home directory.
private static void createDirectory(final String directoryName) {
final File homeDirectory = new File(System.getProperty("user.home"));
final File newDirectory = new File(homeDirectory, directoryName);
if(!newDirectory.exists()) {
boolean result = newDirectory.mkdir();
if(result) {
System.out.println("The directory is created !");
}
} else {
System.out.println("The directory already exist");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment