How to Delete File and Dir

package JavaIOExample;


 * Here we will learn to delete File or Directory
public class DeleteFileAndDir {
	public static void main(String args[]) {
		File file = new File("D:/JBT/testing");

		boolean b = false;

		 * delete() method deletes the file or directory denoted by given
		 * abstract pathname. If this pathname denotes a directory, then the
		 * directory must be empty in order to be deleted.
		b = file.delete();
		if (b)
			System.out.println("File Deleted successfully");
			System.out.println("File deletion failed");




By | 2012-09-21T19:31:52+00:00 September 21st, 2012|Code Base|0 Comments

About the Author:

Leave A Comment