# `File.CopyError`
[🔗](https://github.com/elixir-lang/elixir/blob/6fd161d67d4e62a3d3cbc99b05483177c3172b24/lib/elixir/lib/exception.ex#L2408)

An exception that is raised when copying a file fails.

For example, this exception is raised when trying to copy to file or directory that isn't present:

    iex> File.cp_r!("non_existent", "source_dir/subdir")
    ** (File.CopyError) could not copy recursively from "non_existent" to "source_dir/subdir". non_existent: 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 copied

---

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