public static void zipDir(File zipRootDir, File targetDir, ZipOutputStream out) {

		File[] files = targetDir.listFiles();
		
		byte[] tmpBuf = new byte[1024];
		
		String relative = zipRootDir.toURI()
				.relativize(targetDir.toURI()).getPath();
		
		// Manage folders, excluding the root case
		if(!zipRootDir.equals(targetDir)) {
			
			// Manage empty folder
			if(files.length == 0) {
				logger.trace(" Relative empty folder name: " + relative);
				try {
					out.putNextEntry(new ZipEntry(relative));
					out.closeEntry();
				} catch (IOException e) {
					logger.error("IOException", e);
				}
			} else {
				logger.trace(" Relative folder name: " + relative);
				try {
					out.putNextEntry(new ZipEntry(relative));
					out.closeEntry();
				} catch (IOException e) {
					logger.error("IOException", e);
				}
			}
			
		}

		for (int i = 0; i < files.length; i++) {
			try {
			
				File fileItem = files[i];
				
				relative = zipRootDir.toURI()
						.relativize(fileItem.toURI()).getPath();
				
				if (fileItem.isDirectory()) {
					zipDir(zipRootDir, fileItem, out);
					continue;
				}
				
				if(fileItem.getName().contains(".gz" + App.ARCHIVE_INDICATOR)) {
					deleteAnything(fileItem);
					continue;
				}
				
				FileInputStream in = new FileInputStream(fileItem);
				
				logger.trace(" Relative file name: " + relative);
				
				out.putNextEntry(new ZipEntry(relative));
				
				int len;
				while ((len = in.read(tmpBuf)) > 0) {
					out.write(tmpBuf, 0, len);
				}
				
				logger.debug(" Packed: " + fileItem);

				out.closeEntry();
				in.close();
			
			} catch (IOException e) {
				logger.error("IOException", e);
			}
		}
		
	}