It returns false.
From java doc: - true if the directory was created, false on error, or if the directory already exists.
You should do something like this:
if (file.mkdirs()) { System.out.format("Directory %s has been created.", file.getAbsolutePath()); } else if (file.isDirectory()) { System.out.format("Directory %s has already been created.", file.getAbsolutePath()); } else { System.out.format("Directory %s could not be created.", file.getAbsolutePath()); }
chrizdekok
source share