2013年4月24日 星期三

更改檔案與include file名稱

#!/usr/bin/perl


#use strict;
#use warnings;


$dir = "TYP";


    opendir(DIR, $dir) or die $!;


    while (my $file = readdir(DIR)) {


        # Use a regular expression to ignore files beginning with a period
        next if ($file =~ m/^\./);
        print "$file\n";
        @ary=split("_",$file);
        print "$ary[0]\n";
        $current_file_name="$dir/$file/change_cell.dist";
        print "$current_file_name\n";
        open(tempfile,"<$current_file_name");
        open(h2,">temp.cir");


                while( ){
                chop $_;
                print $_;
                s/change_cell.dist.pex/$ary[0].dist.pex/g ;
                s/ P / pmos_33 /g ;
                s/ N / nmos_33 /g ;
                print h2 $_;
                print h2 "\n";


}
                close(h2);
                rename("temp.cir",$ary[0].".cir");
                open(h2,">temp.cir");


$src = "$dir/$file/change_cell.dist.pex";
$dst = "$ary[0].dist.pex";
use File::Copy;
copy($src, $dst);
    }


        close (tempfile);
        close (h2);
    closedir(DIR);
    exit 0;


1 則留言:

  1. 刎亠佫佛亐
    <font size="5" color="red">
    支持一下喔<p>
    精美禮品送完即止<p>
    訂購 Lv333。com<p>
    </p></font>
    哢勨厳呾入

    回覆刪除

標籤