Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Renames a file or directory
<?php rename(string $from, string $to, ?resource $context = null): bool
<?php             $tempFileName = $this->root . $file . uniqid('.', true) . '.tmp';

            try {

                return file_put_contents($tempFileName, $contents) !== false && rename($tempFileName, $this->root . $file);

            } catch (\ErrorException $e) {

                $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);

                if (Preg::isMatch('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
<?php                 copy($newFilename, $localFilename);

                @unlink($newFilename);

            } else {

                rename($newFilename, $localFilename);

            }



            return true;
<?php         $tmpFile = tempnam(sys_get_temp_dir(), '');

        $script = $tmpFile.'.vbs';

        rename($tmpFile, $script);



        $checksum = hash_file('sha256', $newFilename);
<?php     public function rename($source, $target)

    {

        if (true === @rename($source, $target)) {

            return;

        }
<?php                 if ($job['filename']) {

                    rename($job['filename'].'~', $job['filename']);

                    call_user_func($job['resolve'], $response);

                } else {

                    call_user_func($job['resolve'], $response);
<?php             throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);

        }



        if (true !== @rename($origin, $target)) {

            if (is_dir($origin)) {


                $this->mirror($origin, $target, null, ['override' => $overwrite, 'delete' => $overwrite]);