# `File.RenameError`
[🔗](https://github.com/elixir-lang/elixir/blob/v1.20.0-rc.3/lib/elixir/lib/exception.ex#L2442)

An exception that is raised when renaming a file fails.

For example, this exception is raised when trying to rename a file that isn't present:

  iex> File.rename!("source.txt", "target.txt")
  ** (File.RenameError) could not rename from "source.txt" to "target.txt": no such file or directory

The following fields of this exception are public and can be accessed freely:

  * `:source` (`t:Path.t/0`) - the source path
  * `:destination` (`t:Path.t/0`) - the destination path
  * `:reason` (`t:File.posix/0`) - the reason why the file could not be renamed

---

*Consult [api-reference.md](api-reference.md) for complete listing*
