I BioKid wrote: > I have a simple - yet trivial problem - > > I 2000 directory at /home2/foo/foodir/ . > I need to copy all files with extension *.atm and *.ali to another > directory > called temp (say /home2/foo/foodir/temp ) > After that I need to run a program in each of this directory - (say joy > *.ali )
This should get you started (UNTESTED): use File::Copy; my $from_dir = '/home2/foo/foodir'; my $to_dir = '/home2/foo/foodir/temp'; -d $to_dir or mkdir $to_dir or die "Cannot mkdir '$to_dir' $!"; opendir my $dh, $from_dir or die "Cannot open '$from_dir' $!"; while ( my $file = readdir $dh ) { next unless $file =~ /\.a(?:tm|li)\z/; copy( "$from_dir/$file", "$to_dir/$file" ) or warn "Cannot copy '$from_dir/$file' $!"; } closedir $dh; chdir $to_dir or die "Cannot chdir '$to_dir' $!"; for my $file ( <*.ali> ) { system( 'joy', $file ) == 0 or die "system 'joy' '$file' failed: $?"; } John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>