#!/usr/bin/perl -w
use strict;
use warnings;
use diagnostics;
print "Attention: please start this script in console (f.e. cmd.exe)\nand change to correct device first (f.e. d:)\n";
print "Please insert path to test (f.e. \\my place\\music): ";
my $input = <STDIN>;
chomp $input;
my @filenames;
if (opendir my $fh,$input) {
foreach my $file (readdir $fh) {
next if $file eq '.' || $file eq '..';
if (-f "$input/$file" && !-z "$input/$file") {
push @filenames,$file;
}
}
}
else {
print "Sorry, can not open directory '$input', error '$!'\n";
print "Simulation starts:\n\n";
@filenames = (
'auf dem hohen berg-roger wittaker.mpg',
'schoene welt-heino.mpg',
);
}
foreach (@filenames) {
if ($_ =~ /^([^-]+)-([^\.]+)\.(.+)$/) {
print "old: $_ ** new: '$2-$1.$3'\n";
}
}