Skip to content

Instantly share code, notes, and snippets.

@gfldex
Created March 16, 2017 22:20
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 gfldex/57295d0b40942f1b7cf3448ee8a787b6 to your computer and use it in GitHub Desktop.
Save gfldex/57295d0b40942f1b7cf3448ee8a787b6 to your computer and use it in GitHub Desktop.
multi sub total-size(IO::Path $top) {
my Int $size-sum = 0;
given $top {
when :f { $size-sum = .s }
when :d { $size-sum = [+] $top.&dir».&total-size }
}
$size-sum
}
multi sub total-size(Failure) {
0
}
say total-size('/home/dex'.IO);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment