in reply to Re: Problem with renaming files in directory
in thread Problem with renaming files in directory
foreach my $filename (reverse((grep /^sniffer/, <*>))) { my $new_name = $filename; if($new_name =~ m/(\d+)/) { my $value = $1 +1; $new_name = "sniffer$value.log"; } else { $new_name = "sniffer1.log"; } rename($filename, $new_name) unless $filename eq $new_name; }
I didn't run with -T switch and I have all the time the error. Do you have any other hints ? :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Problem with renaming files in directory
by toolic (Bishop) on Jan 03, 2012 at 16:42 UTC | |
by ice_ice_ice (Initiate) on Jan 03, 2012 at 21:00 UTC | |
by toolic (Bishop) on Jan 03, 2012 at 21:40 UTC | |
by ice_ice_ice (Initiate) on Jan 03, 2012 at 21:59 UTC |