File.copy
$file.copy($toPath, $options={}) -> $toPath
Description
Copy the file to a new path.
If the destination path already exists, an error will be triggered.
$fromFile = file'files:/dir1/data1.txt' $toFile = file'files:/dir2/data2.txt' $fromFile.copy($toFile)
Options
Option | Value | Description |
---|---|---|
overwrite |
true/false | Overwrite the target if it already exists. |
$fromFile.copy($toFile, -overwrite)