driveflexfuel
New Member
- Messages
 - 159
 
- Reaction score
 - 0
 
- Points
 - 0
 
I have been working on a software package.  All the install files are in a folder called install.  When the installation is finished they are forwarded to a file called delete_install.php which is in the install folder.  I have been trying to figure out how to delete the install folder and all files in it. I found the code below but im unsure if it will work properly.  
	
	
	
		
Will this work or do I need to do something else. Thanks in advance.
			
			
		Code:
	
	<?php
$dirname = './install';
if (is_dir($dirname))
    $dir_handle = opendir($dirname);
if (!$dir_handle)
    return false;
while($file = readdir($dir_handle)) {
    if ($file != "." && $file != "..") {
        if (!is_dir($dirname."/".$file))
          unlink($dirname."/".$file);
        else
          delete_directory($dirname.'/'.$file);          
    }
}
closedir($dir_handle);
rmdir($dirname);
return true;
?>
	Will this work or do I need to do something else. Thanks in advance.