Posted By

sekihin on 01/10/11


Tagged

php file


Versions (?)

Delete file


 / Published in: PHP
 

  1. function deldir($dir) {
  2. $dh=opendir($dir);
  3. while ($file=readdir($dh)) {
  4. if($file!="." && $file!="..") {
  5. $fullpath=$dir."/".$file;
  6. if(!is_dir($fullpath)) {
  7. if($file != "abc.csv") {
  8. unlink($fullpath);
  9. }
  10. } else {
  11. deldir($fullpath);
  12. }
  13. }
  14. }
  15.  
  16. closedir($dh);
  17.  
  18. }

Report this snippet  

You need to login to post a comment.