home *** CD-ROM | disk | FTP | other *** search
/ ftp.muug.mb.ca / 2014.06.ftp.muug.mb.ca.tar / ftp.muug.mb.ca / pub / src / perl / eg / findtar < prev    next >
Text File  |  1992-04-11  |  497b  |  18 lines

  1. #!/usr/bin/perl
  2.  
  3. # $Header: findtar,v 4.0 91/03/20 01:09:48 lwall Locked $
  4.  
  5. # findtar takes find-style arguments and spits out a tarfile on stdout.
  6. # It won't work unless your find supports -ls and your tar the I flag.
  7.  
  8. $args = join(' ',@ARGV);
  9. open(find,"/usr/bin/find $args -ls |") || die "Can't run find for you.";
  10.  
  11. open(tar,"| /bin/tar cIf - -") || die "Can't run tar for you: $!";
  12.  
  13. while (<find>) {
  14.     @x = split(' ');
  15.     if ($x[2] =~ /^d/) { print tar '-d ';}
  16.     print tar $x[10],"\n";
  17. }
  18.