coder_upgrade_clean_directory($path, $remove_me = FALSE)Remove all files from the specified directory and optionally remove the directory.
string $path Directory path.
sites/all/modules/coder/coder_upgrade/coder_upgrade.inc, line 73
<?php
function coder_upgrade_clean_directory($path, $remove_me = FALSE) {
$path = $path . '/';
if (!is_dir($path)) {
return;
}
$files = scandir($path);
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
$file_path = $path . $file;
if (is_dir($file_path)) {
coder_upgrade_clean_directory($file_path, TRUE);
}
else {
file_unmanaged_delete($file_path);
}
}
}
if ($remove_me) {
rmdir($path);
}
}
?>