add timestamp check script
SVN-Revision: 3677
This commit is contained in:
parent
e3199bd4d6
commit
6d35e9d0f5
1 changed files with 40 additions and 0 deletions
40
openwrt/scripts/timestamp.pl
Executable file
40
openwrt/scripts/timestamp.pl
Executable file
|
@ -0,0 +1,40 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
sub get_ts($) {
|
||||||
|
my $path = shift;
|
||||||
|
my $ts = 0;
|
||||||
|
open FIND, "find $path -not -path \\*.svn\\* -and -not -path \\*CVS\\* |";
|
||||||
|
while (<FIND>) {
|
||||||
|
open FILE, "<$_";
|
||||||
|
my @stat = stat FILE;
|
||||||
|
close FILE;
|
||||||
|
$ts = $stat[9] if ($stat[9] > $ts);
|
||||||
|
}
|
||||||
|
close FIND;
|
||||||
|
return $ts;
|
||||||
|
}
|
||||||
|
|
||||||
|
(@ARGV > 0) or push @ARGV, ".";
|
||||||
|
my $ts = 0;
|
||||||
|
my $n = ".";
|
||||||
|
my %options;
|
||||||
|
foreach my $path (@ARGV) {
|
||||||
|
if ($path =~ /^-/) {
|
||||||
|
$options{$path} = 1;
|
||||||
|
} else {
|
||||||
|
my $tmp = get_ts($path);
|
||||||
|
if ($tmp > $ts) {
|
||||||
|
$n = $path;
|
||||||
|
$ts = $tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($options{"-p"}) {
|
||||||
|
print "$n\n";
|
||||||
|
} elsif ($options{"-t"}) {
|
||||||
|
print "$ts\n";
|
||||||
|
} else {
|
||||||
|
print "$n\t$ts\n";
|
||||||
|
}
|
Loading…
Reference in a new issue