zl程序教程

您现在的位置是:首页 >  后端

当前栏目

java simple check whether a file or directory.

JAVA File or Directory check Simple
2023-09-27 14:28:06 时间

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