Skip to content

Instantly share code, notes, and snippets.

@sergot
Created February 22, 2012 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergot/1888091 to your computer and use it in GitHub Desktop.
Save sergot/1888091 to your computer and use it in GitHub Desktop.
rm_rf() for Perl 6
use v6;
use File::Find;
sub rm_rf(*@files) is export {
for @files -> $path {
for find(dir => $path).map({ .Str }).reverse -> $f {
$f.IO.d ?? rmdir($f) !! unlink($f);
}
rmdir $path;
}
}
rm_rf('p/a/t/h');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment