Hi,
 I have a couple of problems. I have multiple files on a server that are
all audio files. Some are mp3, some are waves. I need to change there
names because of a new automation system being put in here at the
station. The files are curretly laid out with a series of
numbers+songtitle+artist+time.ext. What I simply need to do is remove
the numbers (except for the 3 in mp3), and change the + to _. I found a
script that will do this with regular expressions. Here is the problem
though. I run the script and it does not loop through the file to take
out all of the numbers unless I run it several times. It also refuses to
take out the +. I'm really really new to perl...in fact I know just
enough to be extremely dangerous :D. If anyone could point me in the
right direction I would appreciate.
Code:

#!/usr/bin/perl
#
# Usage: rename perlexpr [files]

($regexp = shift @ARGV) || die "Usage:  rename perlexpr [filenames]\n";

if ([EMAIL PROTECTED]) {
   @ARGV = <STDIN>;
   chomp(@ARGV);
}


foreach $_ (@ARGV) {
   $old_name = $_;
   eval $regexp;
   die $@ if $@;
   rename($old_name, $_) unless $old_name eq $_;
   print("$old_name\t");
   print("$_\n");
}

exit(0);

David Smith



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to