1 #!/usr/bin/perl -- -*- mode: cperl -*-
5 rrr-dirtyupdate - add a file with an old timestamp to the dataset
9 rrr-dirtyupdate [options] principalfile file [epoch]
11 rrr-dirtyupdate --force principalfile
19 my @opt = <<'=back' =~ /B<--(\S+)>/g;
23 Force this run even without any arguments. E.g. just for the side
24 effect of running an aggregate call.
28 Prints a brief message and exists.
38 When you later discover missing files...
40 The principalfile argument is the path to local principal recentfile.
42 The file argument must be an existing file.
44 If the epoch argument is missing it is calculated from the
45 modification time of the file.
49 This is slow: it calls aggregate twice with force which took 2 x 10-20 seconds on PAUSE.
57 use File
::Find
qw(find);
58 use File
::Rsync
::Mirror
::Recent
;
60 use Pod
::Usage
qw(pod2usage);
71 my $aggregate_only = 0;
72 if (@ARGV == 1 && $Opt{force
}) {
74 } elsif (@ARGV >= 3) {
78 my($principal,$file,$epoch) = @ARGV;
79 my $recc = File
::Rsync
::Mirror
::Recent
->new
80 (local => $principal);
81 my($rf) = $recc->recentfiles;
83 unless ($aggregate_only) {
84 unless (defined $epoch) {
85 my(@stat) = stat $file or die "Could not stat '$file': $!";
88 $rf->update($file,"new",$epoch);
90 warn localtime()." starting first aggregate\n";
91 $rf->aggregate(force
=> 1);
92 warn localtime()." starting second aggregate\n";
93 $rf->aggregate(force
=> 1);
94 warn localtime()." finished\n";
103 # cperl-indent-level: 4