
$path="/home/slaguerr/work/MISE11/RunAssembly";
#$path="/home/slaguerr/work/MISE11/Pyrocleaner";

#for ($i=13,; $i<49; $i++) {
#	`mkdir $path/RL$i`;
#}


@files = <$path/MISE*>;
foreach $file (@files) {
	$newname = $file;
	
	if ($file =~ /MISE1-11\.MISE-2\./) {$newname =~ s/MISE1-11\.MISE-2\./RL1\/MISE11\.RL1\.cor2\./;}
	elsif ($file =~ /MISE1-11\.MISE-3\./) {$newname =~ s/MISE1-11\.MISE-3\./RL2\/MISE11\.RL2\.cor3\./;}
	elsif ($file =~ /MISE1-11\.MISE-4\./) {$newname =~ s/MISE1-11\.MISE-4\./RL3\/MISE11\.RL3\.cor4\./;}
	elsif ($file =~ /MISE1-11\.MISE-5\./) {$newname =~ s/MISE1-11\.MISE-5\./RL4\/MISE11\.RL4\.cor5\./;}
	elsif ($file =~ /MISE1-11\.MISE-6\./) {$newname =~ s/MISE1-11\.MISE-6\./RL5\/MISE11\.RL5\.cor6\./;}
	elsif ($file =~ /MISE1-11\.MISE-9\./) {$newname =~ s/MISE1-11\.MISE-9\./RL6\/MISE11\.RL6\.cor9\./;}
	elsif ($file =~ /MISE1-11\.MISE-367\./) {$newname =~ s/MISE1-11\.MISE-367\./RL7\/MISE11\.RL7\.cor367\./;}
	elsif ($file =~ /MISE1-11\.MISE-368\./) {$newname =~ s/MISE1-11\.MISE-368\./RL8\/MISE11\.RL8\.cor368\./;}
	elsif ($file =~ /MISE1-11\.MISE-369\./) {$newname =~ s/MISE1-11\.MISE-369\./RL9\/MISE11\.RL9\.cor369\./;}
	elsif ($file =~ /MISE1-11\.MISE-370\./) {$newname =~ s/MISE1-11\.MISE-370\./RL10\/MISE11\.RL10\.cor370\./;}
	elsif ($file =~ /MISE1-11\.MISE-372\./) {$newname =~ s/MISE1-11\.MISE-372\./RL11\/MISE11\.RL11\.cor372\./;}
	elsif ($file =~ /MISE1-11\.MISE-425\./) {$newname =~ s/MISE1-11\.MISE-425\./RL12\/MISE11\.RL12\.cor425\./;}

	elsif ($file =~ /MISE2-11\.MISE-426\./) {$newname =~ s/MISE2-11\.MISE-426\./RL13\/MISE11\.RL13\.cor426\./;}
	elsif ($file =~ /MISE2-11\.MISE-427\./) {$newname =~ s/MISE2-11\.MISE-427\./RL14\/MISE11\.RL14\.cor427\./;}
	elsif ($file =~ /MISE2-11\.MISE-428\./) {$newname =~ s/MISE2-11\.MISE-428\./RL15\/MISE11\.RL15\.cor428\./;}
	elsif ($file =~ /MISE2-11\.MISE-430\./) {$newname =~ s/MISE2-11\.MISE-430\./RL16\/MISE11\.RL16\.cor430\./;}
	elsif ($file =~ /MISE2-11\.MISE-431\./) {$newname =~ s/MISE2-11\.MISE-431\./RL17\/MISE11\.RL17\.cor431\./;}
	elsif ($file =~ /MISE2-11\.MISE-432\./) {$newname =~ s/MISE2-11\.MISE-432\./RL18\/MISE11\.RL18\.cor432\./;}
	elsif ($file =~ /MISE2-11\.MISE-433\./) {$newname =~ s/MISE2-11\.MISE-433\./RL19\/MISE11\.RL19\.cor433\./;}
	elsif ($file =~ /MISE2-11\.MISE-434\./) {$newname =~ s/MISE2-11\.MISE-434\./RL20\/MISE11\.RL20\.cor434\./;}
	elsif ($file =~ /MISE2-11\.MISE-435\./) {$newname =~ s/MISE2-11\.MISE-435\./RL21\/MISE11\.RL21\.cor435\./;}
	elsif ($file =~ /MISE2-11\.MISE-436\./) {$newname =~ s/MISE2-11\.MISE-436\./RL22\/MISE11\.RL22\.cor436\./;}
	elsif ($file =~ /MISE2-11\.MISE-437\./) {$newname =~ s/MISE2-11\.MISE-437\./RL23\/MISE11\.RL23\.cor437\./;}
	elsif ($file =~ /MISE2-11\.MISE-438\./) {$newname =~ s/MISE2-11\.MISE-438\./RL24\/MISE11\.RL24\.cor438\./;}

	# Le bloc 3 qui a permis de gerer les fichiers de MISE1 du 02/12/2011 a été effacé par erreur

	elsif ($file =~ /MISE_2\.245\./) {$newname =~ s/MISE_2\.245\./RL37\/MISE11\.RL37\.cor245\./;}
	elsif ($file =~ /MISE_2\.247\./) {$newname =~ s/MISE_2\.247\./RL38\/MISE11\.RL38\.cor247\./;}
	elsif ($file =~ /MISE_2\.249\./) {$newname =~ s/MISE_2\.249\./RL39\/MISE11\.RL39\.cor249\./;}
	elsif ($file =~ /MISE_2\.310\./) {$newname =~ s/MISE_2\.310\./RL40\/MISE11\.RL40\.cor310\./;}
	elsif ($file =~ /MISE_2\.336\./) {$newname =~ s/MISE_2\.336\./RL41\/MISE11\.RL41\.cor336\./;}
	elsif ($file =~ /MISE_2\.354\./) {$newname =~ s/MISE_2\.354\./RL42\/MISE11\.RL42\.cor354\./;}
	elsif ($file =~ /MISE_2\.355\./) {$newname =~ s/MISE_2\.355\./RL43\/MISE11\.RL43\.cor355\./;}
	elsif ($file =~ /MISE_2\.356\./) {$newname =~ s/MISE_2\.356\./RL44\/MISE11\.RL44\.cor356\./;}
	elsif ($file =~ /MISE_2\.357\./) {$newname =~ s/MISE_2\.357\./RL45\/MISE11\.RL45\.cor357\./;}
	elsif ($file =~ /MISE_2\.358\./) {$newname =~ s/MISE_2\.358\./RL46\/MISE11\.RL46\.cor358\./;}
	elsif ($file =~ /MISE_2\.360\./) {$newname =~ s/MISE_2\.360\./RL47\/MISE11\.RL47\.cor360\./;}
	elsif ($file =~ /MISE_2\.429\./) {$newname =~ s/MISE_2\.429\./RL48\/MISE11\.RL48\.cor429\./;}
	
	print "oldname : $file\n";
	print "newname : $newname\n";	
	`mv $file $newname`;
}

