blob: 6b9c07dc53f61ac663ec8acb14d0a682f618ae7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/usr/bin/perl -w
use File::Find;
$listdir = shift;
$list = shift;
find({ wanted => \&wanted, preprocess => \&sortfiles }, $listdir);
exit;
sub sortfiles {
# sort in reverse
sort { $b cmp $a } @_;
}
# note that we need to cope with weekly archives too (seventh digit)
sub wanted {
return unless /^$list/;
/$list.(\d{4})(\d{2})(\d?)/;
$year = $1;
$month = $2;
$sub = $3 if defined $3;
print "$year $month $sub\n";
}
|