static long deleteObsoleteCounterFiles(String application) {
		final Calendar nowMinusOneYearAndADay = Calendar.getInstance();
		nowMinusOneYearAndADay.add(Calendar.DAY_OF_YEAR, -getObsoleteStatsDays());
		nowMinusOneYearAndADay.add(Calendar.DAY_OF_YEAR, -1);
		// filtre pour ne garder que les fichiers d'extension .ser.gz et pour éviter d'instancier des File inutiles
		long diskUsage = 0;
		for (final File file : listSerGzFiles(application)) {
			boolean deleted = false;
			if (file.lastModified() < nowMinusOneYearAndADay.getTimeInMillis()) {
				deleted = file.delete();
			}
			if (!deleted) {
				diskUsage += file.length();
			}
		}

		// on retourne true si tous les fichiers .ser.gz obsolètes ont été supprimés, false sinon
		return diskUsage;
	}
@Test
	public void testDeleteObsoleteCounterFiles() throws IOException {
		final Counter counter = new Counter("http", null);
		counter.setApplication("test counter");
		final File storageDir = Parameters.getStorageDirectory(counter.getApplication());
		final File obsoleteFile = new File(storageDir, "obsolete.ser.gz");
		final File notObsoleteFile = new File(storageDir, "notobsolete.ser.gz");
		checkSetup(storageDir, obsoleteFile, notObsoleteFile);
		final Calendar nowMinus1YearAnd2Days = Calendar.getInstance();
		nowMinus1YearAnd2Days.add(Calendar.YEAR, -1);
		nowMinus1YearAnd2Days.add(Calendar.DAY_OF_YEAR, -2);
		if (!obsoleteFile.setLastModified(nowMinus1YearAnd2Days.getTimeInMillis())) {
			fail("setLastModified");
		}

		CounterStorage.deleteObsoleteCounterFiles(counter.getApplication());

		// le fichier doit avoir été supprimé
		if (obsoleteFile.exists()) {
			fail("obsolete file still exists");
		}
		if (!notObsoleteFile.delete()) {
			notObsoleteFile.deleteOnExit();
		}

		Utils.setProperty(Parameter.OBSOLETE_STATS_DAYS, "1");
		CounterStorage.deleteObsoleteCounterFiles(counter.getApplication());
	}