On Fri, May 1, 2020 at 11:40 PM ToddAndMargo via perl6-users
<perl6-us...@perl.org <mailto:perl6-us...@perl.org>> wrote:
Hi All,
https://docs.perl6.org/routine/copy
(IO::Path) routine copy
Defined as:
method copy(IO::Path:D: IO() $to, :$createonly --> Bool:D)
sub copy(IO() $from, IO() $to, :$createonly --> Bool:D)
Copies a file. Returns True on success; fails with
X::IO::Copy if :$createonly is True and the $to path
already exists or if the operation failed for some
other reason, such as when $to and $from are the same
file.
Huh?
1) what exactly is `:$createonly`?
2) is there some other command for recurse and create?
cp -Rip source destination
Many thanks,
-T
On 2020-05-01 21:23, Paul Procacci wrote:
$createonly fails to do a copy when the destination file already exists.
An example of shell commands to emulate this is:
# echo a > test1
# echo b > test2
# cp -n test2 test1
# cat test1
a
As for recursion...you probably need to write a recursive function
somewhere (didn't look that hard).
Thank you.
Raku allows a sub to call itself, so I
could do the recursion with that.
Hmm, but would file attributes be copied too?