Create list-files.php

This commit is contained in:
SubleXBle
2025-07-28 01:10:41 +02:00
committed by GitHub
parent a4b2f311ba
commit 4823aabfb6
+16
View File
@@ -0,0 +1,16 @@
<?php
// Directory with JSON files
$jsonDir = __DIR__ . '/archive/';
// List all matching JSON files
$files = array_values(array_filter(scandir($jsonDir), function($f) {
return preg_match('/^fail2ban-events-\d{8}\.json$/', $f);
}));
// Sort files descending (newest first)
rsort($files);
// Output as JSON for JS
$filesJson = json_encode($files);
?>