
Hi,
Hi how to delete file if exists?
I need example code of java delete file if exists.
Thanks

Hi,
following code can be used:
String tempFile = "C:/mydir/myfile.txt";
//Delete if tempFile exists
File fileTemp = new File(tempFile);
if (fileTemp.exists()){
fileTemp.delete();
}
thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
