package sis.util; import java.io.*; public class IOUtil { public static boolean delete(String... filenames) { boolean deletedAll = true; for (String filename: filenames) if (!new File(filename).delete()) deletedAll = false; return deletedAll; } } The delete method uses varargs to allow you to delete multiple files in a single method call. It returns true only if all files were successfully deleted. |