File::Path::Copy
Francis Grizzly Smit (grizzly@smit.id.au)
v0.1.18
File::Path::Copy
A Raku module for recursively copying or deleting files.
GPL V3.0+ LICENSE
This is a Raku module to recursively copy or delete files.
None of the other modules I tried worked so here is mine.
sub copypath(IO::Path $from, IO::Path $to,
Bool:D :d(:$dontrecurse) = False, Bool:D :c(:$createonly) = False,
Bool:D :n(:$no-to-check) = False, Bool:D :$backtrace = False,
Bool:D :$noErrorMessages = False --> Bool:D) is exportCopy the $from path to the $to path recursively by default.
Where
-
$fromThe path to copy from. -
$toThe path to copy to. -
:d:$dontrecurseDon't copy recursively, by default it will copy recursively. -
:c:$createonlyMakes it an Error to try to overwrite a file. -
:n:$no-to-checkDon't do the check on whether the to file is the same as the source.- i.e. normally will check if
$from.basename eq $to.basenameif so then will try to copy$from/*into$to/*note this includes.files; if this is true will not do this.
- i.e. normally will check if
-
:$backtraceShow backtrace messages for any error messages. -
:$noErrorMessagesDon't show error messages.
sub prunepath(IO::Path $path, Bool:D :$backtrace = False,
Bool:D :$noErrorMessages = False --> Bool:D) is exportRemove a path and everything under it.
Where
-
$pathThe path to prune. -
:$backtraceIf true then write backtrace to any error messages. item1:$noErrorMessagesDon't show error messages.
sub emptypath(IO::Path $path, Bool:D :$backtrace = False,
Bool:D :$noErrorMessages = False --> Bool:D) is exportRemove everything under a path, but leave the path.
Where
-
$pathThe path to prune. -
:$backtraceIf true then write backtrace to any error messages. item1:$noErrorMessagesDon't show error messages.