aboutsummaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/eg/findtar
blob: 1c9f823beea59321bfb0fb5e4d3d24e5dc2b821b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl

# $Header: /home/ncvs/src/gnu/usr.bin/perl/eg/findtar,v 1.1.1.1 1994/09/10 06:27:47 gclarkii 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";
}