Delete file if exists
This commit is contained in:
@@ -126,12 +126,17 @@ public class ZipUtils {
|
|||||||
{
|
{
|
||||||
ZipEntry zipEntry = zipEntries.nextElement();
|
ZipEntry zipEntry = zipEntries.nextElement();
|
||||||
File newFile = new File(destination, zipEntry.getName());
|
File newFile = new File(destination, zipEntry.getName());
|
||||||
|
System.out.println("Got file " + newFile.getAbsolutePath());
|
||||||
//create sub directories
|
//create sub directories
|
||||||
newFile.getParentFile().mkdirs();
|
newFile.getParentFile().mkdirs();
|
||||||
|
|
||||||
if (!zipEntry.isDirectory())
|
if (!zipEntry.isDirectory())
|
||||||
{
|
{
|
||||||
|
if(newFile.exists())
|
||||||
|
{
|
||||||
|
System.out.println("File " + newFile + "exists, replacing");
|
||||||
|
newFile.delete();
|
||||||
|
}
|
||||||
FileOutputStream outputStream = null;
|
FileOutputStream outputStream = null;
|
||||||
BufferedInputStream inputStream = null;
|
BufferedInputStream inputStream = null;
|
||||||
try
|
try
|
||||||
|
|||||||
Reference in New Issue
Block a user