diff --git a/src/cli/document/clean.php b/src/cli/document/clean.php index 67d7c52..12eb3fd 100644 --- a/src/cli/document/clean.php +++ b/src/cli/document/clean.php @@ -123,9 +123,17 @@ foreach ($config->cli->document->crawl->skip->stripos->url as $condition) if (is_dir($location)) { - if (rmdir($location)) + foreach ((array) scandir($location) as $filename) { - $snaps++; + if (is_dir($filename) || is_link($filename) || str_starts_with($filename, '.') || !str_ends_with($filename, '.tar.gz')) + { + continue; + } + + if (unlink($filename)) + { + $snaps++; + } } }