3 # Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
5 # traverse the entire filesystem dumping info.
19 unless (@stat=lstat("$file")) {
20 printf("%-" . ($opt{v}?65:32) . "s $file\n", "!!! could not lstat");
24 $stat[0]=$stat[8]=""; # wipe the device and access time
26 $md5->add(join(" ",@stat));
28 print join(" ",@stat), "\n";
31 print $md5->hexdigest . " ";
36 if (!defined($link = readlink $file)) {
37 printf("%-32s $file\n", "!!! could not readlink");
41 } elsif (-f "$file") {
42 if (!open(FILE, "$file")) {
43 printf("%-32s $file\n", "!!! could not read");
49 print $md5->hexdigest . " $file\n";
54 die "Usage: $0 <dir>\n" unless (@ARGV == 1);
57 die "can't read $dir\n" unless (-r $dir);
58 die "$dir is not a directory\n" unless (-d _);
60 chomp($HOST = `hostname -s`);
62 print "*** fs-walk host $HOST dir $dir\n";
65 while ($dir = shift @todo) {
67 unless (opendir(DIR,$dir)) {
68 printf("%-" . ($opt{v}?65:32) . "s $dir\n", "!!! could not opendir");
71 unless (@all=readdir(DIR)) {
72 printf("%-" . ($opt{v}?65:32) . "s $dir\n", "!!! could not readdir");
76 @dirs=grep(-d "$dir/$_" && !-l "$dir/$_", @all);
82 foreach (grep(!/^\.\.?$/, @dirs)) {
83 push (@todo,"$dir/$_");