Delete file if exists

This commit is contained in:
Flare Microsystems
2024-11-16 21:58:53 -08:00
parent fe98b1186b
commit cd8a5e88b7

View File

@@ -126,12 +126,17 @@ public class ZipUtils {
{
ZipEntry zipEntry = zipEntries.nextElement();
File newFile = new File(destination, zipEntry.getName());
System.out.println("Got file " + newFile.getAbsolutePath());
//create sub directories
newFile.getParentFile().mkdirs();
if (!zipEntry.isDirectory())
{
if(newFile.exists())
{
System.out.println("File " + newFile + "exists, replacing");
newFile.delete();
}
FileOutputStream outputStream = null;
BufferedInputStream inputStream = null;
try