public static function CopyDirFiles($path_from, $path_to, $ReWrite = True, $Recursive = False)
 {
     if (strpos($path_to . "/", $path_from . "/") === 0 || realpath($path_to) === realpath($path_from)) {
         return false;
     }
     if (is_dir($path_from)) {
         CheckDirPath($path_to . "/");
     } elseif (is_file($path_from)) {
         $p = bxstrrpos($path_to, "/");
         $path_to_dir = substr($path_to, 0, $p);
         CheckDirPath($path_to_dir . "/");
         if (file_exists($path_to) && !$ReWrite) {
             return False;
         }
         @copy($path_from, $path_to);
         if (is_file($path_to)) {
             @chmod($path_to, BX_FILE_PERMISSIONS);
         }
         return True;
     } else {
         return True;
     }
     if ($handle = @opendir($path_from)) {
         while (($file = readdir($handle)) !== false) {
             if ($file == "." || $file == "..") {
                 continue;
             }
             // skip files with non-safe names
             if (!CLearnHelper::IsBaseFilenameSafe($file)) {
                 continue;
             }
             if (is_dir($path_from . "/" . $file) && $Recursive) {
                 self::CopyDirFiles($path_from . "/" . $file, $path_to . "/" . $file, $ReWrite, $Recursive);
             } elseif (is_file($path_from . "/" . $file)) {
                 if (file_exists($path_to . "/" . $file) && !$ReWrite) {
                     continue;
                 }
                 @copy($path_from . "/" . $file, $path_to . "/" . $file);
                 @chmod($path_to . "/" . $file, BX_FILE_PERMISSIONS);
             }
         }
         @closedir($handle);
         return true;
     }
     return false;
 }