All pastes #884956 Raw Edit

the thing-v2

public text v1 · immutable
#884956 ·published 2008-01-30 18:13 UTC
rendered paste body
use strict;
use warnings;

opendir(HERE,'.') or die "Epic failure.\n";
my @paths = readdir(HERE);
closedir(HERE) or warn "Whatever.\n";

open(DATA,"data.txt") or die "Rename your text file 'data.txt'.\n";
my @data;
while(<DATA>) {
  chomp;
  next unless length;
  push(@data,$_);
}
close(DATA) or warn "Whatever two.\n";

foreach my $path (@PATHS) {
  next if $path =~ /^\.\.?$/io;
  next if $path =~ /.*\.txt$/io;
  next if $path =~ /.*\.pl$/io;
  my $newpath = sprintf('%s.mp3',shift @data);
  rename($path,$newpath);
}