Return to Snippet

Revision: 66356
at April 22, 2014 21:20 by fedek6


Initial Code
// delete all folder contents recursive    
function delDirContents($dir) {
	$files = glob($dir . '/*', GLOB_MARK);
    
    foreach($files as $file)
    {
        if (is_dir($file)) {
            delDirContents($file);
        } else {
            unlink($file);
        }
    }
}

Initial URL


Initial Description
Delete all files and directories in specified path recursively.

Initial Title
Delete all files and folders in specified paths

Initial Tags


Initial Language
PHP