Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

How do I do to delete files?

  Asked By: Bastet    Date: Jul 28    Category: Java    Views: 624
  

I don't know what is the Class and the method to delete files in
Java.
May anyone help me?

Share: 

 

4 Answers Found

 
Answer #1    Answered By: Miriam Green     Answered On: Jul 28

You can use Properties method
detailed program will be sent later

 
Answer #2    Answered By: Alberta Miller     Answered On: Jul 28

you can use delet() like :
File f = new File("c\...");
f.delet();

 
Answer #3    Answered By: Debbie Reyes     Answered On: Jul 28

You can delete  file in java by following method:

1. Create a File Object to your file, example:

File myTempFile = new File("C:/temp/sample.txt");
// Check if it is a file, i.e, no directory and file exist
if( myTempFile.isFile() && myTempFile.exists() ) {
// Then delete file
myTempFile.delete();
}

Dont forget to import java.io.* at the top.

 
Answer #4    Answered By: Leroy Schmidt     Answered On: Jul 28

file.delete()................................

 
Didn't find what you were looking for? Find more on How do I do to delete files? Or get search suggestion and latest updates.




Tagged: