Hi All,
I have data in 20 different folders named from step_1...step_2 0 and each folder has some files which I am trying to manupulate and after that my program should make directories named step_1_results .... step_20_results and write each results into the respective directory. But somehow my code is not making directories and writing files INTO them instead writing them outside the directories.
Thanks for Help
Kumar
I have data in 20 different folders named from step_1...step_2 0 and each folder has some files which I am trying to manupulate and after that my program should make directories named step_1_results .... step_20_results and write each results into the respective directory. But somehow my code is not making directories and writing files INTO them instead writing them outside the directories.
Code:
#!/usr/bin/perl
use strict;
use warnings;
my $folder = "/home/r/surface_tension/";
opendir(FO,$folder);
my @fols = grep {/step_*/} readdir(FO);
#print "@fols\n";
foreach my $foss(@fols)
{
opendir(FOL,$foss);
my $folname = $foss;
#print "$foss\n";
my @filess = grep {/\.out$/} readdir(FOL);
#for(my $i=0;$i<@filess;$i++)
#{
#print "$filess[$i]\n";
#}
foreach my $eva(@filess)
{
$name = $eva;
$name=~ s/\.out/.pmt/g;
print "$name\n";
`mkdir -p $foss_results`;
`cd $foss_results`;
open(WRITE,"$name_result");
}
}
Kumar