Пример #1
0
 /**
  * Removes a Directory's contents (without removing the directory itself)
  * @author VJ Patel (meetthevj@gmail.com - VJftw @ZPanel Forums)
  * @param string $dir The full path to the directory who's contents to remove
  */
 static function RemoveDirectoryContents($dir)
 {
     $dir = fs_director::ConvertSlashes($dir);
     if (is_dir($dir)) {
         $files = dir($dir);
         if ($files) {
             while ($file = $files->read()) {
                 if ($file != '.' && $file != '..') {
                     if (is_dir($dir . $file)) {
                         fs_filehandler::RemoveDirectoryContents(fs_director::ConvertSlashes($dir . $file . '/'));
                         rmdir($dir . $file);
                     } else {
                         unlink($dir . $file);
                     }
                 }
             }
         }
         $files->close();
     }
 }