Moves a file to another location.
@param string $oldPath Specifies the original path of the file.
@param string $newPath Specifies the new path of the file.
@return boolean
513466
public function moveFile($oldPath, $newPath, $isRename = false)
    {
        $oldPath = self::validatePath($oldPath);
        $fullOldPath = $this->getMediaPath($oldPath);

        $newPath = self::validatePath($newPath);
        $fullNewPath = $this->getMediaPath($newPath);

        return $this->getStorageDisk()->move($fullOldPath, $fullNewPath);
    }
28146
public function move( $folderPath, $force = FALSE )
	{
		if( !$this->moveFolder( $this->folderName, $folderPath, $force ) )
			return FALSE;
		$this->folderName	= $folderPath;
		return TRUE;
	}
230932
protected function pathChanged($oldPath)
    {
        foreach ($this->pathListeners as $cb) {
            $cb($oldPath, $this->path);
        }
    }
160720
public function copyContent(string $newFolderPath): self
    {
        $newFolderPath = normalize_path($newFolderPath);

        if (is_dir($newFolderPath)) {
            if (recursive_copy($this->getPath(), $newFolderPath)) {
                return self::load($newFolderPath);
            }
        }
        throw new FolderException('Cannot copy folder content, because the destination folder path ('.$newFolderPath.') does not exist',
            FolderException::DONT_EXIST);
    }
1207284
private function getNewFileLocationPayload($newPath)
    {
        $pathinfo = pathinfo($newPath);
        $newParentDir = ($pathinfo['dirname'] != '.') ? $pathinfo['dirname'] : '';
        $newFilename = $pathinfo['basename'];

        $payload = [
            'name' => $newFilename,
            'parentReference' => ['path' => $this->getParentReferenceFolder($newParentDir)],
        ];

        return $payload;
    }
1315945
public function move($fromPath, $toPath)
    {
        $fromNode = $this->nodeAt($fromPath);

        try {
            $nodeToOverride = $this->nodeAt($toPath);

            if (!is_a($nodeToOverride, get_class($fromNode))) {
                //nodes of a different type
                throw new \RuntimeException('Can\'t move.');
            }

            if ($nodeToOverride instanceof Directory) {
                if ($nodeToOverride->size()) {
                    //nodes of a different type
                    throw new \RuntimeException('Can\'t override non empty directory.');
                }
            }

            $this->remove($toPath, true);

        } catch (NotFoundException $e) {
            //nothing at destination, we're good
        }

        $toParent = $this->directoryAt(dirname($toPath));

        $fromNode->setBasename(basename($toPath));

        $toParent->addNode($fromNode);

        $this->remove($fromPath, true);

    }
1141113
public function copy($path, $newpath)
    {
        $this->writeStream(static::normalizerPath($newpath), $this->readStream(static::normalizerPath($path))['stream'], new Config() );

        return true;
    }
1059885
public function copyFolder($originalPath, $newPath)
    {
        $disk = $this->getStorageDisk();

        $copyDirectory = function ($srcPath, $destPath) use (&$copyDirectory, $disk) {
            $srcPath = self::validatePath($srcPath);
            $fullSrcPath = $this->getMediaPath($srcPath);

            $destPath = self::validatePath($destPath);
            $fullDestPath = $this->getMediaPath($destPath);

            if (!$disk->makeDirectory($fullDestPath)) {
                return false;
            }

            $folderContents = $this->scanFolderContents($fullSrcPath);

            foreach ($folderContents['folders'] as $dirInfo) {
                if (!$copyDirectory($dirInfo->path, $destPath.'/'.basename($dirInfo->path))) {
                    return false;
                }
            }

            foreach ($folderContents['files'] as $fileInfo) {
                $fullFileSrcPath = $this->getMediaPath($fileInfo->path);

                if (!$disk->copy($fullFileSrcPath, $fullDestPath.'/'.basename($fileInfo->path))) {
                    return false;
                }
            }

            return true;
        };

        return $copyDirectory($originalPath, $newPath);
    }
821210
public function rename($path, $newPath)
    {
        $resource = Uploader::rename(
            $this->converter->pathToId($path),
            $this->converter->pathToId($newPath)
        );

        return $this->addPathToResource($resource);
    }
912902
protected function renameFile($path, $newName)
    {
        $newPath = pathinfo($path, PATHINFO_DIRNAME) . '/' . $newName;

        try {
            $success = rename($path, $newPath);

            // @codeCoverageIgnoreStart
        } catch (\Exception $e) {
            throw new CouldNotRetrieveRemoteFileException("Failed to rename '{$path}' to '{$newName}'", $e->getCode(), $e);
            // @codeCoverageIgnoreEnd
        }

        // @codeCoverageIgnoreStart
        if ( ! $success) {
            throw new CouldNotRetrieveRemoteFileException("Failed to rename '{$path}' to '{$newName}'");
        }
        // @codeCoverageIgnoreEnd

        return $newPath;
    }
1323140
public function rename($path, $newpath)
    {
        return (bool)$this->normalizeResponse(
            Cosapi::move($this->getBucket(), $path, $newpath, 1)
        );
    }
39716
public function equals($anotherPath) {
		$anotherPath = $anotherPath instanceof Path ? $anotherPath : new Path($anotherPath);

		if ($this->isStream() ^ $anotherPath->isStream()) {
			return false;
		}

		if ($this->isStream() && $anotherPath->isStream()) {
			return $this->toString() === $anotherPath->toString();
		}

		return realpath($this->pathname->toString()) == realpath($anotherPath->toString());
	}
1007144
public function move($new_path)
	{
		$info = pathinfo($this->path);

		$new_path = $this->area->get_path($new_path);
		$new_path = rtrim($new_path, '\\/').DS.$info['basename'];

		$return = $this->area->rename($this->path, $new_path);
		$return and $this->path = $new_path;

		return $return;
	}
832161
public function rename($path, $newPath)
    {
        $this->recursiveCreateDir(Util::dirname($newPath));

        $location = $this->applyPathPrefix($path);
        $destination = $this->applyPathPrefix($newPath);

        try {
            $this->share->rename($location, $destination);
        } catch (NotFoundException $e) {
            return false;
        } catch (AlreadyExistsException $e) {
            return false;
        }

        return true;
    }
624979
private function rename(string $oldPath, string $newPath): bool
    {
        if (!@rename($oldPath, $newPath)) {
            $message = 'Could not rename file.';
            if ($error = error_get_last()) {
                $message .= sprintf(' Errno: %d; %s', $error['type'], $error['message']);
            }
            throw new FileException($message);
        }

        return true;
    }
1182309
public function save($savepath) {
		$result = move_uploaded_file($this->stored_filename, $savepath);
		if ($result === true) {
			$this->stored_filename = $savepath;
			return true;
		} else {
			return false;
		}
	}
313113
public function copy($newPath = null)
    {
        if (is_null($newPath)) {
            $newPath = $this->path . '-copy';
        }

        if (@$this->filesystem->copy($this->path, $newPath)) {
            return $this->getClone()->setPath($newPath);
        } else {
            $lastError = error_get_last();
            throw new CopyFailedException($this, $newPath, $lastError['message']);
        }
    }