java determines whether a file exists:
public static String fileExists(String plainFilePath){ File file=new File(plainFilePath); if(!file.exists()) { return "false"; } else{ return "true"; } }
file_exists is a function whose Chinese name is to check whether a file or directory exists. (If under Linux. The permission of the parent folder that needs to be detected is not 777, false will be returned)
bool file_exists ( string filename )
If the file or directory specified by filename exists, it will return TRUE, otherwise it will return FALSE.
In Windows, use //computername/share/filename or \\computername\share\filename to check shared files on the network.
For more java knowledge, please pay attention to java basic tutorial.
The above is the detailed content of How to determine whether a file exists in java. For more information, please follow other related articles on the PHP Chinese website!