Code:
String dir = //Path to the directory File saveDir = new File(dir); //Here comes the existence check if(!saveDir.exists()) saveDir.
new File(dir).getCanonicalFile().isDirectory();
Skeleton for your reference:-
File f = new File("...."); if (!f.exists()) { // The directory does not exist. ... } else if (!f.isDirectory()) { // It is not a directory (i.e. it is a file). ... }