Ref: check whether a file or directory
First, make sure the path exists by using:
new File(path).exists();
Then check whether it a directory using:
1 new File(path).isDirectory();
Similary,check whether it a file by using:
1 new File(path).isFile();
java simple check whether a file or directory.,布布扣,bubuko.com
java simple check whether a file or directory.
原文:http://www.cnblogs.com/listened/p/3576262.html