Skip to content

Kirby 4.5.0

$file->rename()

Changes the name of the file without touching the extension

$file->rename(string $newName, bool $overwrite = false): Kirby\Filesystem\File

Parameters

Name Type Default Description
$newName * string
$overwrite bool false Force overwrite existing files

Return type

Kirby\Filesystem\File

This method does not modify the existing $file object but returns a new object with the changes applied. Learn more →

Parent class

Kirby\Filesystem\File