-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsym_check.pl
More file actions
50 lines (33 loc) · 770 Bytes
/
sym_check.pl
File metadata and controls
50 lines (33 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/perl
=pod
=head1 NAME
sym_check.pl - Find bad symbolic links
=head1 SYNOPSIS
sym_link.pl <dir> [<dir> ...]
=head1 DESCRIPTION
The I<sym_link.pl> program scans the given directories for broken
symbolic links.
=head1 AUTHOR
Steve Oualline, E<lt>oualline@www.oualline.comE<gt>.
=head1 COPYRIGHT
Copyright 2005 Steve Oualline.
This program is distributed under the GPL.
=cut
use strict;
use warnings;
use File::Find ();
use vars qw/*name *dir *prune/;
*name = *File::Find::name;
*dir = *File::Find::dir;
*prune = *File::Find::prune;
# Traverse desired filesystems
File::Find::find({wanted => \&wanted}, @ARGV);
exit;
sub wanted {
if (-l $_) {
my @stat = stat($_);
if ($#stat == -1) {
print "Bad link: $name\n";
}
}
}