Add content-length header; increase default block size; add timings; add IP address
[ambdownload.git] / domd5sums.pl
1 #!/usr/bin/perl
2
3 use File::stat;
4 use strict;
5 use warnings;
6
7 use File::Basename;
8 use File::stat;
9 use MIME::Base64;
10 use File::Spec;
11 use File::Spec::Functions qw(rel2abs);
12
13 my $datadir = dirname(rel2abs($0))."/";
14
15 sub getfile
16 {
17     my $fn = $datadir.(shift @_);
18     $fn = File::Spec->rel2abs( readlink($fn) ) if (-l $fn);
19     return undef unless ( -f $fn);
20     return $fn;
21 }
22
23 my $dir;
24 opendir($dir, $datadir);
25 my @links = grep { /^[^.]/ && -l $datadir.$_ } readdir($dir);
26 closedir($dir);
27  
28 foreach my $link (@links) {
29     my $target = getfile($link);
30     next unless ( defined ($target) && -f $target);
31     next unless ( $datadir eq dirname($target)."/" );
32     system ("md5sum '$target' | tee '$target.md5sum'");
33 }