diff options
Diffstat (limited to 'bin/checklinks')
-rwxr-xr-x | bin/checklinks | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bin/checklinks b/bin/checklinks index a2e21af..5016aba 100755 --- a/bin/checklinks +++ b/bin/checklinks @@ -105,8 +105,11 @@ sub check_hardlink { sub mkdirs { my $source = shift; my $path = $base; - $source =~ s/\/[^\/]+$//; - foreach(split(/\//, $source)) { + my @dirs = split(/\//, $source); + + # the last element is the file + pop(@dirs); + foreach(@dirs) { unless(-d "$path/$_") { mkdir("$path/$_") or die("Can't create $path/$_: $!"); } |