Function copy

Source
pub fn copy<P: AsRef<Path>, Q: AsRef<Path>>(
    source: P,
    target: Q,
) -> Result<(), FileError>
Expand description

Copies the file or directory at source into the target path. If the source is a file and the target is not a directory, the source file is copied to the target path. If the source is a file and the target is a directory, the source file is copied into the target directory. If the source is a directory and the target is not a file, the source directory and all files in it are copied recursively into the target directory. For example, with source=dir1 and target=dir2, dir1/file would be copied to dir2/dir1/file. If the source is a directory and the target is a file, an error is returned.