in reply to Re^2: renaming all files in a directory
in thread renaming all files in a directory

An alternative way to make the "next" directory:
use Modern::Perl; use File::Find::Rule; my $directory = 'c:/data/strawberry-perl/perl/script-chrome'; my $dir_pattern = 'test_'; my $next = ( sort { $b <=> $a } map { /(\d+)$/; $1 } File::Find::Rule->directory ->name( "$dir_pattern*" ) ->in( $directory ) )[0] + 1; mkdir "$directory/$dir_pattern$next", 0755 or die "Could not make dire +ctory $directory/$dir_pattern$next";

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics