Why file.mkdir is returning false?
Google indicates that there could be several reasons (e.g. security, permissions, pathname, etc).
My questions:
No, there's no way to find the exact reason mkdirs()
returns false, at least not from within Java, as it would probably be OS dependent.
A SecurityException
is thrown if there is a security violation in the SecurityManager
's checkRead()
and checkWrite()
methods. The exception isn't thrown if there is an OS permissions issue.
Additionally, note that if you call File.mkdir()
, and the parent directory doesn't exist, mkdir()
will return false. However, calling File.mkdirs()
will create the non-existent parent directories.