1 #!/usr/bin/perl
2
3 use Encode;
4 my $i=0;
5
6 opendir(DIR,".");
2
3 use Encode;
4 my $i=0;
5
6 opendir(DIR,".");
7 my @file=readdir(DIR);
8 foreach my $temp (@file)
9 {
10 if($temp=~/^d0/)
11 {
12 #print $temp."\n";
13 my $newName=".//".$temp;
14 print $newName."\n";
15 opendir(DIR2,$newName);
16 my @file1=readdir(DIR2);
17 foreach my $temp2 (@file1)
18 {
19 # print $temp2."\n";
20 my $names=".//".$temp."//".$temp2;
21 print $names."\n";
22 open(FILE,$names);
23 my $line;
24 while(<FILE>)
25 {
26 $line.=$_;
27 }
28 # print $line;
29 if($line=~/utf-8/)
30 {
31 $line = encode("gb2312", decode("utf8", $line));
32 }
33
34 my $filename=".//result//".$i;
35 open(FILE1,">>$filename");
36 print FILE1 $line;
37
38 $i=$i+1;
39 }
40 }
41 }