java simple check whether a file or directory.

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();

 

posted @ 2014-03-02 01:41  wonkju  阅读(171)  评论(0编辑  收藏  举报