|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T f
Length: 1197 (0x4ad) Types: TextFile Names: »findcp«
└─⟦4f9d7c866⟧ Bits:30007245 EUUGD6: Sikkerheds distributionen └─⟦b5330643c⟧ »./cops/perl-4.019/perl.tar.Z« └─⟦2b9a58213⟧ └─⟦this⟧ »perl-4.019/eg/findcp«
#!/usr/bin/perl # $Header: findcp,v 4.0 91/03/20 01:09:37 lwall Locked $ # 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(); }