#!usr/bin/perl -W # pure Perl directory copying script use File::Find; $from = $ARGV[0]; # from should be full path $to = $ARGV[1]; # to should have / at the end mkdir( $to ) || die "cant mkdir $to: $!"; find( \©routine, $from ); sub copyroutine { if( $_ eq '.' || $_ eq '..' ){ return 1 } print "got $_\n"; open( FROM, $_ ) || die "cant open $_: $!"; open( TO, "> $to$_" ) || die "cant make $to$_ : $!"; while( $line = ) { print TO $line; } close TO; close FROM; }