Skip to content

Instantly share code, notes, and snippets.

@tomaszmadeyski
Created December 27, 2013 12:20
Show Gist options
  • Save tomaszmadeyski/337c8c7e66dd42475ec4 to your computer and use it in GitHub Desktop.
Save tomaszmadeyski/337c8c7e66dd42475ec4 to your computer and use it in GitHub Desktop.
A script to remove directories as a apache user
<?php
ini_set("display_errors",true);
error_reporting(E_ALL);
function rrmdir($dir) {
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir."/".$object) == "dir") rrmdir($dir."/".$object); else unlink($dir."/".$object);
}
}
reset($objects);
rmdir($dir);
}
}
rmdir('cache/front');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment