Now i need to copy data inside the zip files to one .txt file i.e all R1 folder file data should copy and save in one R1.txt file similarly R2 folder file data should save in one single R2.txt file. is it possible to copy data from zipped files??
#!/usr/bin/perl
use File::Copy;
use strict;
use warnings;
print"Enter Folder name
";
print"File name: ";
chomp(my $Filename=<>);
mkdir "R1";
mkdir "R2";
opendir(DIR,"$Filename") or die "cannot open directory";
foreach my $name (readdir(DIR))
{
next if ($name =~ /^./);
if($name =~ /R1/) { #compare $name not $Filename
copy("$Filename/$name", "R1"); # copy the file from folder to R1 directory
system("cat $Filename/$name >> R1.txt");
}
elsif($name =~ /R2/){
copy("$Filename/$name","R2"); ## copy the file from folder to R2 directory
system("cat $Filename/$name >> R2.txt");
}
}
thanks in advance.
See Question&Answers more detail:os