log.info("[deleteEntriesRecursively] The FileEntry to delete is a folder. Deleting all nested entries: ");
List<String> containedFiles = getFileEntryChildren(zip, toDelete);
if(containedFiles.size()>0) {
for (String currentEntryPath : containedFiles) {
FileEntry current = zip.getFileEntry(currentEntryPath);
if(current!=null) {
deleteEntriesRecursively(zip, current, deletedEntries);
}
}
log.info("[deleteEntriesRecursively] Deleted entry: " + toDelete.getName());
deletedEntries.add(zip.delete(toDelete.getName()));
}
else {
log.info("[deleteEntriesRecursively] Deleted entry: " + toDelete.getName());
deletedEntries.add(zip.delete(toDelete.getName()));
}
}
else {
FileEntry current = zip.delete(toDelete.getName());
log.info("[deleteEntriesRecursively] Deleted entry: " + toDelete.getName());
deletedEntries.add(current);
}
} catch (IOException e) {
e.printStackTrace();