Created
March 10, 2015 22:26
-
-
Save sercey/14aa06481f80896d66fc to your computer and use it in GitHub Desktop.
Belirtilen dizindeki tüm dosya ve klasorleri siler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function recurse_remove($dir, $remove_parent = false){ | |
$it = new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS); | |
$files = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::CHILD_FIRST); | |
foreach($files as $file) { | |
if ($file->isDir()){ | |
rmdir($file->getRealPath()); | |
} else { | |
unlink($file->getRealPath()); | |
} | |
} | |
if($remove_parent == true){ | |
rmdir($dir); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment