1
Currently I have a . bat that runs copying files from the network from one server to another. This made a job that was done manually much easier, but I noticed that by removing some increments (flourishes) from . bat, he improved his performance of running the copies of the files.
I’ll be posting the code. bat and if possible, could help me perform it, making it shorter, performative, but maintaining its main goal.
The goal is to take ids from a.txt list and copy the files with their Ids to another network folder. NOTE: I was pouring in a log in case I didn’t find the file but I’m not needed 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 you have any tips? Not including or decreasing variables, remove comments, run location and not use variables, etc...