in reply to Help on renaming a bunch of files
Try this, it uses a glob to read in a list of files that match the desired directory and name structure, generates the new name from the old one, and then renames them. In this case we rename all the files that end with 'pl' so that they instead end with 'bak';
my $dir = "c:/"; while (<$dir*.pl>) { my ($old,$new); $old = $new = $_; $new =~ s/pl$/bak/; rename $old, $new; }
Hope this helps
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Help on renaming a bunch of files
by mndoci (Scribe) on Jul 11, 2001 at 05:28 UTC |