Advertisement
Guest User

Untitled

a guest
Apr 30th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.47 KB | None | 0 0
  1. #!/usr/bin/env perl6
  2.  
  3. use v6;
  4.  
  5. ### Recursive directory search function:
  6.  
  7. my $build-log-regex = /build\.log/ ; # filename to search for
  8. my $start-dir = "/var/tmp/portage"; # directory to start in
  9.  
  10. # say "/var/tmp/portage".IO.d;
  11.  
  12. sub get-build-logs($current-dir) {
  13.     for dir($current-dir) -> $item {
  14.         if $item.IO.f {if $item.basename ~~ $build-log-regex {say $item;}}
  15.         if $item.IO.d {get-build-logs($item);}
  16.         }
  17.     }
  18.    
  19.    
  20. # calling function
  21. get-build-logs($start-dir);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement