I currently have a .bat that runs copying network files from one server to another. This made a lot of work easier for me that was done manually, but I noticed that by removing some .bat flourishes, it improved its execution performance on file copies.
I'll be posting the .bat code and if possible, could help me perform it, making it shorter, performative, but keeping its main purpose.
The goal is to get ids from a list.txt and copy the files with their IDs to another folder on the network. NOTE: I was dumping into a log if I did not find the file, but I do not need it so I removed it.
@echo off
rem Pasta para colar os arquivos copiados.
set minhaPasta=I:\ARQUIVOS_ENCONTRADOS
rem Arquivo txt que o processo vai ler com o nome dos arquivos "LISTA DOS IDs".
set meuArquivo=I:PASTA\lista.txt
rem Pasta onde estão os arquivos que devem ser copiados, tem que ter a barra no final "\".
set pastaArquivos=J:\
rem Extensão dos arquivos a serem copiados.
set tipo=.xml
rem Comando para criar as pastas caso elas não existam no meu computador
rem if not exist %minhaPasta% md %minhaPasta%
rem Caso o arquivo que tem os nomes dos arquivos não exista vai gravar o log informando.
rem Inicio da verificação
for /F "tokens=*" %%A in (%meuArquivo%) do (
copy %pastaArquivos%*%%A*%tipo% %minhaPasta%
)
pause
Is it possible to improve the performance of this .bat? Would they have any tips? Not even include or reduce variables, remove comments, execute location and use variables, etc ...