On Thu, 2002-01-24 at 10:32, Allan Whiteford wrote:
> [EMAIL PROTECTED] wrote:
> > 99
> > Thanks Allan,
> >
> > I'll try this.
> >
> > We reckon it would also be possible to do it with perl, but since I haven't
> > yet found it in any of the online perl script libraries I've looked in,
> > and haven't yet got past chapter one of Learning Perl (or "The Llama Book"
> > as I believe you're meant to call it)....
<snip>
<fx=puts on asbestos cloak>
I'm sure Lawrence or any other experienced perl monger could compress
this down to about 2 lines including the #! but heres my feeble attempt
#!/usr/bin/perl
#
my $newdir=shift or printusage();
unless ($newdir=~m/.*\/$/){
$newdir="$newdir/";
}
my $filename;
my $counter =1;
foreach $filename (@ARGV){
warn $filename;
$filename=~m/.*(\..*$)/;
system("cp $filename $newdir/$counter$1");
$counter++;
}
sub printusage{
print "Usage: renamer dir filename [filename]\n";
}
--------------------------------------------------------------------
http://www.lug.org.uk http://www.linuxportal.co.uk
http://www.linuxjob.co.uk http://www.linuxshop.co.uk
--------------------------------------------------------------------