2011年3月24日 星期四

更改目錄中的檔案名稱

#!/usr/bin/perl


$dirname = "/mtc12/home2/user/michael/Zcircuit/Socle/DATA/LVT_cells/Net_spc";
opendir(DIR, $dirname) or die "can't opendir $dirname: $!";
while (defined($file = readdir(DIR))) {
                $dut =  $dirname."/".$file;
                $a_name = $file;
                @ary=split(/\./, $a_name);
                $new_file_name = $ary[0].".".$ary[1];
                print $new_file_name."\n";
                rename($dut, $new_file_name);
                #copy($dut, $new_file_name);
}
        closedir(DIR);


沒有留言:

張貼留言

標籤