diff options
Diffstat (limited to 'contrib/perl5/eg/findcp')
-rw-r--r-- | contrib/perl5/eg/findcp | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/contrib/perl5/eg/findcp b/contrib/perl5/eg/findcp deleted file mode 100644 index 5dba040..0000000 --- a/contrib/perl5/eg/findcp +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/perl - -# $RCSfile: findcp,v $$Revision: 4.1 $$Date: 92/08/07 17:20:12 $ - -# This is a wrapper around the find command that pretends find has a switch -# of the form -cp host:destination. It presumes your find implements -ls. -# It uses tar to do the actual copy. If your tar knows about the I switch -# you may prefer to use findtar, since this one has to do the tar in batches. - -sub copy { - `tar cf - $list | rsh $desthost cd $destdir '&&' tar xBpf -`; -} - -$sourcedir = $ARGV[0]; -if ($sourcedir =~ /^\//) { - $ARGV[0] = '.'; - unless (chdir($sourcedir)) { die "Can't find directory $sourcedir: $!"; } -} - -$args = join(' ',@ARGV); -if ($args =~ s/-cp *([^ ]+)/-ls/) { - $dest = $1; - if ($dest =~ /(.*):(.*)/) { - $desthost = $1; - $destdir = $2; - } - else { - die "Malformed destination--should be host:directory"; - } -} -else { - die("No destination specified"); -} - -open(find,"find $args |") || die "Can't run find for you: $!"; - -while (<find>) { - @x = split(' '); - if ($x[2] =~ /^d/) { next;} - chop($filename = $x[10]); - if (length($list) > 5000) { - do copy(); - $list = ''; - } - else { - $list .= ' '; - } - $list .= $filename; -} - -if ($list) { - do copy(); -} |