Skip to content

Instantly share code, notes, and snippets.

@samcv
Last active February 8, 2017 06:52
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 samcv/c658da51e0cdc4a5bbbbb20d13796650 to your computer and use it in GitHub Desktop.
Save samcv/c658da51e0cdc4a5bbbbb20d13796650 to your computer and use it in GitHub Desktop.
sub MAIN($dir = '.') {
my @todo = $dir.IO;
my @list;
my @lines = $dir eq '.' ?? run( 'find', :out).out.lines !! run('find', $dir, :out).out.lines;
$_.IO.e or @list.push($_.IO) for @lines;
while @todo {
for @todo.pop.dir -> $path {
if $path.d {
@todo.push: $path;
$_.IO.e or @list.push($_.IO) for run('find', $path, :out).out.lines;
}
}
}
say @list;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment