1 | #!/opt/bin/perl |
1 | #!/opt/bin/perl |
2 | |
2 | |
3 | # inspired by treescan by Jamie Lokier <jamie@imbolc.ucc.ie> |
3 | # inspired by treescan by Jamie Lokier <jamie@imbolc.ucc.ie> |
4 | # about 40% faster than the original version (on my fs and raid :) |
4 | # about 40% faster than the original version (on my fs and raid :) |
5 | |
5 | |
6 | use strict; |
6 | use common::sense; |
7 | use Getopt::Long; |
7 | use Getopt::Long; |
8 | use Time::HiRes (); |
8 | use Time::HiRes (); |
9 | use IO::AIO; |
9 | use IO::AIO; |
10 | |
10 | |
11 | our $VERSION = $IO::AIO::VERSION; |
11 | our $VERSION = $IO::AIO::VERSION; |
… | |
… | |
65 | |
65 | |
66 | aioreq_pri -1; |
66 | aioreq_pri -1; |
67 | ++$n_dirs; |
67 | ++$n_dirs; |
68 | aio_scandir $path, 8, sub { |
68 | aio_scandir $path, 8, sub { |
69 | my ($dirs, $files) = @_ |
69 | my ($dirs, $files) = @_ |
70 | or warn "$path: $!\n"; |
70 | or return warn "$path: $!\n"; |
71 | |
71 | |
72 | printfn "", [$path] unless $opt_nodirs; |
72 | printfn "", [$path] unless $opt_nodirs; |
73 | printfn $path, $files unless $opt_nofiles; |
73 | printfn $path, $files unless $opt_nofiles; |
74 | |
74 | |
75 | $n_files += @$files; |
75 | $n_files += @$files; |