Copy/Move File

Author: stmuk

You want to copy and move a file

Source code: 09-03-copy-move-file.p6

#!/usr/bin/env perl6

use v6;

# create a file
my $f = open "foo", :w;
$f.print(time);
$f.close;

# copy
my $io = IO::Path.new("foo");
$io.copy("foo2");

# clean up
unlink("foo2");

# move
$io.rename("foo2");

# clean up
unlink("foo2");