if dir does not exist, it will not cause error.
I suggest to use basedirs.exists();