summaryrefslogtreecommitdiff
path: root/sample/fullpath.pl
blob: a07b90edd49106cb5728b28f222a830e78b86e36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#! /usr/local/bin/perl
# convert ls-lR filename into fullpath.

$path = shift;
if (!defined $path) {
    $path = "";
}
elsif ($path !~ /\/$/) {
  $path .= "/"
}

while (<>) {
    if (/:$/) {
	chop; chop;
	$path = $_ . "/";
    } elsif (/^total/ || /^d/) {
	next;
    } elsif (/^(.*\d )(.+)$/) {
	print $1, $path, $2, "\n";
    }
}