Skip to content

Instantly share code, notes, and snippets.

@necromant2005 necromant2005/extract.php
Last active Dec 15, 2015

Embed
What would you like to do?
extract *.gz files and remove error logs for the next step
<?php
$dir = __DIR__ . "/nginx";
foreach (new DirectoryIterator($dir) as $item) {
if (!$item->isFile()) continue;
if (strpos($item, 'access')===false) {
unlink($item->getPathname());
continue;
}
if (!strpos($item, '.gz')) continue;
system('gunzip ' . escapeshellarg($item->getPathname()));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.