in reply to Re^3: selcting a specific file
in thread selcting a specific file
this code works out but the options given by you for selecting and copying only non empty files doesnt work out!! please help me out!!#!/usr/bin/perl $dest="/home/perl/sra/"; print "the source direcotry name:\n"; chomp(my $source=<STDIN>); opendir($DIR, $source) or die "cannot open the directory '$source': $!"; @files =@files = grep { /\.log$/ } readdir ($DIR); foreach my $x (my @files){ open READFILE, "$source/$x"; open WRITEFILE, ">$dest$x"; while(<READFILE>){ chomp; my @parts = split(/\s/, $_); print WRITEFILE $parts[1], " ", $parts[0], "\n"; } close WRITEFILE; close READFILE; } closedir($DIR)
|
|---|