您的位置 首页 java

java中怎么判断文件是否存在

java判断某个文件是否存在:

public static String fileExists(String plainFilePath){File file=new File(plainFilePath);if(!file.exists()) {return "false";} else{return "true";}}

file_exists,是一个函数,中文名是检查文件或目录是否存在。(如果在linux下。需要检测的父级文件夹权限不是 777 会返回false )

bool file_exists ( string filename )

如果由 filename 指定的文件或目录存在则返回 TRUE,否则返回 FALSE。

在 Windows 中要用 //computername/share/filename 或者 \\computername\share\filename 来检查网络中的共享文件。

文章来源:智云一二三科技

文章标题:java中怎么判断文件是否存在

文章地址:https://www.zhihuclub.com/16423.shtml

关于作者: 智云科技

热门文章

网站地图