3 # Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License as
7 # published by the Free Software Foundation.
9 # This program is distributed in the hope that it would be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write the Free Software Foundation,
16 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 # traverse the entire filesystem dumping info.
33 unless (@stat=lstat("$file")) {
34 printf("%-" . ($opt{v}?65:32) . "s $file\n", "!!! could not lstat");
38 $stat[0]=$stat[8]=""; # wipe the device and access time
40 $md5->add(join(" ",@stat));
42 print join(" ",@stat), "\n";
45 print $md5->hexdigest . " ";
50 if (!defined($link = readlink $file)) {
51 printf("%-32s $file\n", "!!! could not readlink");
55 } elsif (-f "$file") {
56 if (!open(FILE, "$file")) {
57 printf("%-32s $file\n", "!!! could not read");
63 print $md5->hexdigest . " $file\n";
68 die "Usage: $0 <dir>\n" unless (@ARGV == 1);
71 die "can't read $dir\n" unless (-r $dir);
72 die "$dir is not a directory\n" unless (-d _);
74 chomp($HOST = `hostname -s`);
76 print "*** fs-walk host $HOST dir $dir\n";
79 while ($dir = shift @todo) {
81 unless (opendir(DIR,$dir)) {
82 printf("%-" . ($opt{v}?65:32) . "s $dir\n", "!!! could not opendir");
85 unless (@all=readdir(DIR)) {
86 printf("%-" . ($opt{v}?65:32) . "s $dir\n", "!!! could not readdir");
90 @dirs=grep(-d "$dir/$_" && !-l "$dir/$_", @all);
96 foreach (grep(!/^\.\.?$/, @dirs)) {
97 push (@todo,"$dir/$_");