There is a perl rename script that allows you to do something like:
# ren 's/^_/section/' *.mp3

I keep it in my bin directory.  You can name it 'ren', or 'rename', or
whatever.  I'll attach it.

-Rob

> What is the #rename command to rename all of these files with
> section_*.mp3, [as in section_1.mp3 for track00.mp3] and so on?
> I've been told this before but I wiped my email files and man page is a
> bit obscure.
> Thanks
#!/usr/bin/perl

#Usage: ren perlexpr [files]

($op = shift) or die "Usage: ren perlexpr [filenames]\n";

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

for (@ARGV) {
  $was = $_;
  eval $op;
  die $@ if $@;
  unless ($was eq $_) {
    rename($was,$_) or die "Unable to rename $was: $!\n";
  }
}

=head1 NAME

B<ren> - use a perl expression to rename multiple files

=head1 SYNOPSIS

B<ren> perl_expression [files]

=head1 DESCRIPTION

B<Ren> uses a perl expression to rename multiple files.  For more information about
perl expressions, consult the perl man pages, F<Learning Perl> by Randal
Schwartz, F<Programming Perl> by Larry Wall, or your local friendly
Perl programmer.

For example, to rename all files foo.* to bar.*, use

  ren 's/foo/bar/;' foo.*


=head1 AUTHORS

Randal Schwartz, Larry Wall

=head1 DATE

October 11, 1996

=cut

_______________________________________________
EuG-LUG mailing list
[EMAIL PROTECTED]
http://mailman.efn.org/cgi-bin/listinfo/eug-lug

Reply via email to