Expected output after rename:foreach my $file (@entries) { next if ($file =~ /^\.+$/); if ( -d $dir . '/' . $file) { runDir($prefix . $file . '_', $dir . '/' . $file); print "***up runDir($prefix . $file . '_', $dir . '/' . + $file)\n"; } elsif ( ( -f $dir . '/' . $file ) && ( $file =~ /\.config$/ +) && ($file !~ /^$prefix/)) { my $suffix = $file; $suffix =~ s/^(\S+)-.+\.config$/$1.config/; print "****rename $dir . '/' . $file, $dir . '/' . $prefix . $su +ffix"."\n"; rename $dir . '/' . $file, $dir . '/' . $prefix . $suffix +; } }
Now the output occurs as follows:DCMS_DEMO_new_block2_checklist_tmp_rev2.html
prefix output: ***up runDir(DCMS_DEMO_de_top_Block_DV_ . rev2 . '_', /home/sa/dcms_ +html_output/DCMS_DEMO/de_top/Block_DV . '/' . rev2) suffix output: Block_DV.config rename output: ****rename /home/sa/dcms_html_output/DCMS_DEMO/de_top/Block_DV . '/' . Block_DV.c +onfig, /home/sa/dcms_html_output/DCMS_DEMO/de_top/Block_DV . '/' . DC +MS_DEMO_de_top_Block_DV_ . Block_DV.config
In reply to renaming the file using perl by finddata
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |