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学问请关注java基础教程。
以上就是java中怎样推断文件是不是存在的细致内容,更多请关注ki4网别的相干文章!