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

 

你可能感兴趣的:(Directory)