1 #!/usr/bin/perl -- -*- mode: cperl -*-
5 rrr-init - set up RECENT files for a directory tree
9 rrr-init [options] directory
17 my @opt = <<'=back' =~ /B<--(\S+)>/g;
19 =item B<--aggregator=s>
21 Comma separated list of aggregator specifications, e.g.
23 --aggregator=1h,6h,1d,1W,1M,1Q,1Y,Z
25 Defaults to C<1h,1d,1M,1Y,Z>
29 Prints a brief message and exists.
39 Walk through a tree and fill all files into initial recentfiles.
48 use lib
"/home/k/sources/rersyncrecent/lib";
49 use File
::Rsync
::Mirror
::Recent
;
50 use File
::Rsync
::Mirror
::Recentfile
;
53 use Pod
::Usage
qw(pod2usage);
54 use Time
::HiRes
qw(time);
70 my $aggregator_string = $Opt{aggregator
} || "1h,1d,1M,1Y,Z";
71 my @aggregator = split /\s*,\s*/, $aggregator_string;
72 my $localroot = File
::Spec
->rel2abs($rootdir);
73 my $rf = File
::Rsync
::Mirror
::Recentfile
->new
75 aggregator
=> \
@aggregator,
76 interval
=> $aggregator[0],
77 localroot
=> $localroot,
78 verbose
=> $Opt{verbose
},
81 foreach my $file ( map {$_->[1]} sort {$a->[0] <=> $b->[0]} map {[-M
$_, $_]} File
::Find
::Rule
->new->file->in($rootdir) ) {
82 $rf->update(File
::Spec
->rel2abs($file),"new");
91 # cperl-indent-level: 4