Skip to content

Instantly share code, notes, and snippets.

@necromant2005
Last active December 15, 2015 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save necromant2005/5283621 to your computer and use it in GitHub Desktop.
Save necromant2005/5283621 to your computer and use it in GitHub Desktop.
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