I am using PHP to move the contents of a images subfolder
GalleryName/images/
into another folder. After the move, I need to del
I prefer an enhaced method derived from the php help pages http://php.net/manual/en/function.rmdir.php#115598
// check accidential empty, root or relative pathes
if (!empty($path) && ...)
{
if (PHP_OS === 'Windows')
{
exec('rd /s /q "'.$path.'"');
}
else
{
exec('rm -rf "'.$path.'"');
}
}
else
{
error_log('path not valid:$path'.var_export($path, true));
}
reasons for my decision: