Monday, August 20, 2012

delete a file using java


This delete the file f1

File f1 = new File(file);
  boolean success = f1.delete();
  if (!success){
  System.out.println("Deletion failed.");
  System.exit(0);
  }else{
  System.out.println("File deleted.");
    }

0 comments:

Post a Comment