Here you can find the source of delfile(String path, String name)
public static boolean delfile(String path, String name)
import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.nio.channels.FileChannel; import java.util.ArrayList; public class Main{ public static boolean delfile(String path, String name) { File file = new File(path + Dependence.getPathChar() + name); file.delete();//from w w w .ja v a 2s.co m return !file.exists(); } public static boolean delfile(String path) { File file = new File(path); file.delete(); return !file.exists(); } }