html `-- DCMS_DEMO |-- DCMS_DEMO.html |-- de_top | |-- Block_DV | | |-- Block_DV.html | | |-- rev1 | | | `-- rev1.html | | `-- rev2 | | `-- rev2.html | |-- CAD_checklist | | |-- CAD_checklist.html | | |-- rev1 | | | `-- rev1.html | | |-- rev2 | | | `-- rev2.html | | |-- rev3 | | | `-- rev3.html | | `-- rev4 | | `-- rev4.html | `-- de_top.html `-- new_block2 |-- ICC_L2_Checklist | |-- ICC_L2_Checklist.html | `-- rev1 | `-- rev1.html |-- checklist_tmp | |-- checklist_tmp.html | |-- rev1 | | `-- rev1.html | `-- rev2 | `-- rev2.html `-- new_block2.html #### html `-- DCMS_DEMO |-- DCMS_DEMO.html |-- de_top | |-- Block_DV | | |-- Block_DV.html | | |-- rev1 | | | `--Block_DV_rev1.html | | `-- rev2 | | `-- Block_DV_rev2.html | |-- CAD_checklist | | |-- CAD_checklist.html | | |-- rev1 | | | `--CAD_checklist_rev1.html | | |-- rev2 | | | `-- CAD_checklist_rev2.html | | |-- rev3 | | | `--CAD_checklist_rev3.html | | `-- rev4 | | `--CAD_checklist_rev4.html | `-- de_top.html `-- new_block2 |-- ICC_L2_Checklist | |-- ICC_L2_Checklist.html | `-- rev1 | `--ICC_L2_checklist_rev1.html |-- checklist_tmp | |-- checklist_tmp.html | |-- rev1 | | `--checklist_tmp_rev1.html | `-- rev2 | `--checklist_tmprev2.html `-- new_block2.html #### sub runDir($$); sub runDir($$) { my $prefix = shift @_; # print $prefix,"\n"; my $dir = shift @_; #print "******$dir***","\n"; opendir(DIR, $dir) or die $!; my @entries = readdir(DIR); # print @entries,"\n"; close(DIR); foreach my $file (@entries) { next if ($file =~ /^\.+$/); if ( -d $dir . '/' . $file) { runDir($prefix . $file . '_', $dir . '/' . $file); } elsif ( ( -f $dir . '/' . $file ) && ( $file =~ /\.config$/ ) && ($file !~ /^$prefix/)) { my $suffix = $file; $suffix =~ s/^(\S+)-.+\.config$/$1.config/; rename $dir . '/' . $file, $dir . '/' . $prefix . $suffix ; } } } runDir('',$output_dir); #### |-- DCMS_DEMO | |-- DCMS_DEMO_DCMS_DEMO.config | |-- DCMS_DEMO_DCMS_DEMO.html | |-- de_top | | |-- Block_DV | | | |-- DCMS_DEMO_de_top_Block_DV_Block_DV.config | | | |-- DCMS_DEMO_de_top_Block_DV_Block_DV.html | | | |-- rev1 | | | | |-- DCMS_DEMO_de_top_Block_DV_rev1_rev1.config | | | | `-- DCMS_DEMO_de_top_Block_DV_rev1_rev1.html | | | `-- rev2 | | | |-- DCMS_DEMO_de_top_Block_DV_rev2_rev2.config | | | `-- DCMS_DEMO_de_top_Block_DV_rev2_rev2.html | | |-- CAD_checklist | | | |-- DCMS_DEMO_de_top_CAD_checklist_CAD_checklist.config | | | |-- DCMS_DEMO_de_top_CAD_checklist_CAD_checklist.html | | | |-- rev1 | | | | |-- DCMS_DEMO_de_top_CAD_checklist_rev1_rev1.config | | | | `-- DCMS_DEMO_de_top_CAD_checklist_rev1_rev1.html | | | |-- rev2 | | | | |-- DCMS_DEMO_de_top_CAD_checklist_rev2_rev2.config | | | | `-- DCMS_DEMO_de_top_CAD_checklist_rev2_rev2.html | | | |-- rev3 | | | | |-- DCMS_DEMO_de_top_CAD_checklist_rev3_rev3.config | | | | `-- DCMS_DEMO_de_top_CAD_checklist_rev3_rev3.html | | | `-- rev4 | | | |-- DCMS_DEMO_de_top_CAD_checklist_rev4_rev4.config | | | `-- DCMS_DEMO_de_top_CAD_checklist_rev4_rev4.html | | |-- DCMS_DEMO_de_top_de_top.config | | |-- DCMS_DEMO_de_top_de_top.html | | `-- ICC_DPMHV_Checklist | `-- new_block2 | |-- CAD_checklist | |-- DCMS_DEMO_new_block2_new_block2.config | |-- DCMS_DEMO_new_block2_new_block2.html | |-- ICC_L2_Checklist | | |-- DCMS_DEMO_new_block2_ICC_L2_Checklist_ICC_L2_Checklist.config | | |-- DCMS_DEMO_new_block2_ICC_L2_Checklist_ICC_L2_Checklist.html | | `-- rev1 | | |-- DCMS_DEMO_new_block2_ICC_L2_Checklist_rev1_rev1.config | | `-- DCMS_DEMO_new_block2_ICC_L2_Checklist_rev1_rev1.html | `-- checklist_tmp | |-- DCMS_DEMO_new_block2_checklist_tmp_checklist_tmp.config | |-- DCMS_DEMO_new_block2_checklist_tmp_checklist_tmp.html | |-- rev1 | | |-- DCMS_DEMO_new_block2_checklist_tmp_rev1_rev1.config | | `-- DCMS_DEMO_new_block2_checklist_tmp_rev1_rev1.html | `-- rev2 | |-- DCMS_DEMO_new_block2_checklist_tmp_rev2_rev2.config | `-- DCMS_DEMO_new_block2_checklist_tmp_rev2_rev2.html `-- html `-- DCMS_DEMO |-- DCMS_DEMO_DCMS_DEMO.html |-- de_top | |-- Block_DV | | |-- DCMS_DEMO_de_top_Block_DV_Block_DV.html | | |-- rev1 | | | `-- DCMS_DEMO_de_top_Block_DV_rev1_rev1.html | | `-- rev2 | | `-- DCMS_DEMO_de_top_Block_DV_rev2_rev2.html | |-- CAD_checklist | | |-- DCMS_DEMO_de_top_CAD_checklist_CAD_checklist.html | | |-- rev1 | | | `-- DCMS_DEMO_de_top_CAD_checklist_rev1_rev1.html | | |-- rev2 | | | `-- DCMS_DEMO_de_top_CAD_checklist_rev2_rev2.html | | |-- rev3 | | | `-- DCMS_DEMO_de_top_CAD_checklist_rev3_rev3.html | | `-- rev4 | | `-- DCMS_DEMO_de_top_CAD_checklist_rev4_rev4.html | `-- DCMS_DEMO_de_top_de_top.html `-- new_block2 |-- DCMS_DEMO_new_block2_new_block2.html |-- ICC_L2_Checklist | |-- DCMS_DEMO_new_block2_ICC_L2_Checklist_ICC_L2_Checklist.html | `-- rev1 | `-- DCMS_DEMO_new_block2_ICC_L2_Checklist_rev1_rev1.html `-- checklist_tmp |-- DCMS_DEMO_new_block2_checklist_tmp_checklist_tmp.html |-- rev1 | `-- DCMS_DEMO_new_block2_checklist_tmp_rev1_rev1.html `-- rev2 `-- DCMS_DEMO_new_block2_checklist_tmp_rev2_rev2.html