txt: ## rename.md
  rename
  
  Combined from primary sources listed below.
  
  # [In IO::Path](#___top "go to top of document")[§](#(IO::Path)_routine_rename "direct link")
  
  See primary documentation
  [in context](/type/IO/Path#routine_rename)
  for **routine rename**.
  
  ```raku
  method rename(IO::Path:D: IO() $to, :$createonly = False --> Bool:D)
  sub    rename(IO() $from, IO() $to, :$createonly = False --> Bool:D)
  ```
  
  Renames a file or directory. Returns `True` on success; [fails](/routine/fail) with [`X::IO::Rename`](/type/X/IO/Rename) if `:$createonly` is `True` and the `$to` path already exists or if the operation failed for some other reason.
  
  **Note:** some renames will always fail, such as when the new name is on a different storage device. See also: [`move`](/routine/move).
  