It is important to check returnvalue of file.mkdirs() since it will

return false when it fails.

If it fails, a NullPointerException will occur on the line with
'for (final File f : parentDir.listFiles()) {'. Kind of difficult to
understand why. This exception should be pretty clear.

We've experienced this using cloudname in our application, because
the user did not have permission to create folders.