move file to other directory

@param File $to new place

@return $this|File
547545
public function move(File $to): File {
		$this->manager->move(
			$this->getUrl(),
			Paths::appendPath($to->getUrl(), $this->getName())
		);

		return new File(Paths::appendPath($this->getUrl(), $this->getName()));
	}
596918
public function move()
	{
		// Make sure the filename is unique if makeFilenameUnique is set to true
		if($this->makeFilenameUnique)
		{
			$this->getUniqueFilename();
		}
		if($this->_validate())
		{
			// Validation passed so create any directories and move the tmp file to the specified location.
			$this->_createDirs();
			if($this->file->isValid())
			{
				// This will also perform some validations on the upload.
				$this->file->move($this->uploadDir, $this->filename);
			}
			else
			{
				throw new Exception($this->file->getErrorMessage());
			}
		}

		return $this->getUploadPath();
	}
123674
public function moveToTop()
    {
        if ($this->isNotInList()) return $this;

        $this->getConnection()->transaction(function() {

            $this->incrementPositionsOfItemsAbove();

            $this->setListPosition($this->listifyTop());
        });

        return $this;
    }
855819
public function move($dest = '')
        {
            rename($this->getFilePath(), $dest);
            $this->setFilePath($dest);

            $this->capsule['filepath'] = $dest;
            return $this;
        }
435814
public function copy(File $to): File {
		$this->manager->copy(
			$this->getUrl(),
			$path = Paths::normalize(Paths::appendPath($to->getUrl(), $this->getName()))
		);

		return new File($path);
	}
117492
private function moveFile($from, $location, $newName)
    {
        $filename  = Str::slug(pathinfo($newName, PATHINFO_FILENAME));
        $extension = pathinfo($newName, PATHINFO_EXTENSION);

        $this->media->move($from, $to = "{$location}/{$filename}.{$extension}");

        return $to;
    }
706730
public function addFile(File $file): self
    {
        $directory = $this->getPath();
        $file->moveToDirectory($directory);

        return $this;
    }
112365
public function moveDirectory( $from, $to, $overwrite = false ): bool
	{
		if( $overwrite && $this->isDirectory( $to ) && ! $this->deleteDirectory( $to ) )
		{
			return false;
		}
		return @ rename( $from, $to ) === true;
	}
575702
public function copyFile( $from, $to )
	{
		$this->connection->checkConnection();
		$temp	= uniqid( time() ).".temp";
		$reader	= new Net_FTP_Reader( $this->connection );
		$reader->setPath( $this->getPath() );
		if( !$reader->getFile( $from, $temp ) )
			throw new RuntimeException( 'File "'.$from.'" could not be received.' );
		if( !$this->putFile( $temp, $to ) )
		{
			unlink( $temp );
			throw new RuntimeException( 'File "'.$from.'" could not be stored.' );
		}
		unlink( $temp );
		return TRUE;
	}
1184355
static function  rebasedFilename($file,$from,$to) {
		if (!Strings::startsWith($file, $from)) {
			throw new \InvalidArgumentException("File $file is not in directory $from");
		}
		$secondPart=Strings::substring($file, Strings::length($from));
		if ($secondPart[0]=="/") $secondPart=substr($secondPart,1);
		$newPath=$to."/".$secondPart;
		return $newPath;
	}
80687
protected function publishDirectory($from, $to)
    {
        $this->moveManagedFiles(new MountManager([
            'from' => new \League\Flysystem\Filesystem(new Local($from)),
            'to' => new \League\Flysystem\Filesystem(new Local($to))
        ]));

        $this->status($from, $to, 'Directory');
    }
468648
public function move($directory, $name = null)
    {
        $this->dir($directory);

        $this->name($name);

        return $this;
    }
680197
public function moveDataFile($from, $to)
    {
        if (str_contains($from, '*.')) {
            $this->moveFilesWildcard($from, $to);

            return;
        }

        if (file_exists($from = $this->dataDir($from))) {
            $this->mkDir(dirname($to = $this->dataDir($to)));

            rename($from, $to);
        }
    }
322906
public function renameFile($file, $to = null) {
		if(!is_array($file)) // rename(file, to);
		{
			$file = [
				$file => $to,
			];
		}
		$this->begin();
		foreach($file as $from => $to) {
			$this->run('git mv', $from, $to);
		}
		return $this->end();
	}
1117648
protected function copy($from, $to = null)
    {
        if (is_array($from) && is_null($to)) {
            foreach ($from as $key => $value) {
                $this->copy($key, $value);
            }

            return;
        }

        if (!file_exists($from)) {
            return;
        }

        $to = $this->extensionPath($to);

        $this->filesystem->copy($from, $to);
    }
951659
def move_to(self, folder):
        
        if isinstance(folder, Folder):
            self.move_to(folder.id)
        else:
            self._move_to(folder)
843758
public function moveToDirectory($directory)
    {
        $targetPath = rtrim($directory, '/') . '/' . $this->getClientFilename();

        return $this->moveTo($targetPath);
    }