Delete File

Code ตัวอย่างการลบ ไฟล์ครับ note ไว้เผื่อจะจำไม่ได้

/**
 * File Name : DeleteFile.java
 * Created Date : Nov 12, 2009 : 9:54:26 AM
 * Copyright © 2009 www.fun4station.com
 */
package com.fun4station.example;

import java.io.File;

/**
 * @Author Supot Saelao 
 * @Version 1.0
 */
public class DeleteFile {

	public static void main(String[] args) {
		File file = new File("test-file.txt");
		if(file.exists()){
			if(file.delete()){
				System.out.println("Delete file success....");
			}else{
				System.out.println("Delete file fail....");
			}
		}else{
			System.out.println("File not found ....");
		}
	}
}

ข้อมูลจาก
Deleting a File

  1. No comments yet.

  1. No trackbacks yet.