in reply to File::Find: Problem with renaming folders recursively
use warnings; use strict; use File::Find::Rule; my $path = $ARGV[0]; my $from = $ARGV[1]; my $to = $ARGV[2]; die "You must supply a full directory path" unless (-e $path && -d $pa +th); my @dirs = File::Find::Rule->directory() ->name("*$from*") ->in($path); for (@dirs) { my $orig = $_; s/$from/$to/g; rename $orig, $_ or die "Can not rename $orig to $_: $!"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: File::Find: Problem with renaming folders recursively (File::Find::Rule)
by runrig (Abbot) on Mar 20, 2009 at 17:28 UTC | |
|
Re^2: File::Find: Problem with renaming folders recursively (File::Find::Rule)
by Anonymous Monk on Mar 20, 2009 at 17:26 UTC | |
by toolic (Bishop) on Mar 23, 2009 at 02:38 UTC | |
by larus (Acolyte) on Mar 23, 2009 at 06:36 UTC |