$file->rename($to)

Renames the file and all the meta text files.

Example

$file = $page->file('file-with-old-name.pdf');

try {

  $file->rename('new-name.pdf');
  echo 'The file has been renamed';

} catch(Exception $e) {

  echo 'The file could not be renamed';
  // optional reason: echo $e->getMessage();

}