Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- # Renomeador v1.0
- # * KeplerBR (28/10/2012 16:00) :
- # - Released!
- #
- # [EN]
- # Rename automatically the images of the cards of the game Ragnarok.
- # Be included num2cardillustnametable.txt and images of the card in the same directory!
- # Both of you get through the GRF Tool.
- # Easily adaptable to other rename files based on a text file.
- # [PT-BR]
- # Renomear automaticamente as imagens das cartas do jogo Ragnarok.
- # Tenha incluído o num2cardillustnametable.txt e as imagens da carta no mesmo diretório!
- # Ambos você consegue através do GRF Tool.
- # Facilmente adaptável para renomear outros arquivos com base em um arquivo de texto.
- # ------------------
- # By KeplerBR
- # Definindo variáveis
- use strict;
- use warnings;
- sub renomear() {
- my (@separado, @listaErros);
- my $linhaAtual = 0;
- # Rotina para renomear
- open(my $arq,'num2cardillustnametable.txt');
- while(<$arq>)
- {
- $linhaAtual++;
- chomp;
- if ($_ ne "") {
- @separado = split(/#/);
- $separado[0] = $separado[0] . '.bmp';
- $separado[1] = $separado[1] . '.bmp';
- if (-e $separado[1]) {
- rename ($separado[1], $separado[0]);
- print "[+] $linhaAtual: $separado[1] renomeado para $separado[0]\n";
- } else {
- print "[!] $linhaAtual: Não foi encontrado o $separado[1]!\n";
- push (@listaErros, "[!] $linhaAtual: Não foi renomeado o $separado[1] para $separado[0]\n");
- }
- }
- };
- # Finalizando rotina
- print "\n\n";
- close($arq);
- if (@listaErros == 0) {
- print "[-] Renomeação concluída com sucesso!\n";
- } else {
- print "[-] Renomeação terminou com os seguintes problemas:\n";
- print @listaErros;
- }
- print "\n\n";
- system('pause');
- }
- &renomear();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement