12345678910111213141516171819202122232425262728293031323334353637383940 | '\" t
.\" Copyright (c) 2026 Bruce Hill
.\" All rights reserved.
.\"
.TH Path.copy_to 3 2026-09-01 "Tomo man-pages"
.SH NAME
Path.copy_to \- copy a file or directory
.SH LIBRARY
Tomo Standard Library
.SH SYNOPSIS
.nf
.BI Path.copy_to\ :\ func(path:\ Path,\ dest:\ Path,\ overwrite:\ Bool\ =\ no\ ->\ Result)
.fi
.SH DESCRIPTION
Copies the file or directory from one location to another. This is the same behavior as `cp -rn -T src dest` or `cp -rf -T src dest` (if `overwrite` is enabled).
.SH ARGUMENTS
.TS
allbox;
lb lb lbx lb
l l l l.
Name Type Description Default
path Path The path to copy. -
dest Path The destination to copy the path to. -
overwrite Bool Whether to permit overwriting the destination if it is an existing file or directory. no
.TE
.SH RETURN
Either `Success` or `Failure{reason}`.
.SH NOTES
Copying a tree is many operations rather than one, so unlike `Path.move` this cannot be indivisible. With `overwrite=no` an existing destination is never written over, but if one appears while the copy is running it is skipped silently rather than reported.
.SH EXAMPLES
.EX
(./file.txt).copy_to(/tmp/copy.txt)!
.EE
.SH SEE ALSO
.BR Tomo-Path (3)
|