summaryrefslogtreecommitdiff
path: root/eg/findtar
diff options
context:
space:
mode:
Diffstat (limited to 'eg/findtar')
-rw-r--r--eg/findtar17
1 files changed, 17 insertions, 0 deletions
diff --git a/eg/findtar b/eg/findtar
new file mode 100644
index 0000000000..8b604b396f
--- /dev/null
+++ b/eg/findtar
@@ -0,0 +1,17 @@
+#!/usr/bin/perl
+
+# $Header: findtar,v 2.0 88/06/05 00:16:49 root Exp $
+
+# findtar takes find-style arguments and spits out a tarfile on stdout.
+# It won't work unless your find supports -ls and your tar the I flag.
+
+$args = join(' ',@ARGV);
+open(find,"/usr/bin/find $args -ls |") || die "Can't run find for you.";
+
+open(tar,"| /bin/tar cIf - -") || die "Can't run tar for you.";
+
+while (<find>) {
+ @x = split(' ');
+ if ($x[2] =~ /^d/) { print tar '-d ';}
+ print tar $x[10],"\n";
+}