summaryrefslogtreecommitdiff
path: root/sample/fullpath.pl
diff options
context:
space:
mode:
Diffstat (limited to 'sample/fullpath.pl')
-rw-r--r--sample/fullpath.pl22
1 files changed, 22 insertions, 0 deletions
diff --git a/sample/fullpath.pl b/sample/fullpath.pl
new file mode 100644
index 0000000000..a07b90edd4
--- /dev/null
+++ b/sample/fullpath.pl
@@ -0,0 +1,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";
+ }
+}
+