0

I'm new in batch files and in gdal, so I've been trying to run this script in .bat, BUT it keeps repeating one loop, so if I have 2 *.tif (utm1.tif and utm2.tif) files in the folder, it creates 3 .tif (testeutm1.tif, testeutm2.tif and testetesteutm1.tif), and one of the has the "testeteste" prefix, which means that is using one of the created tif.

I've already try a :end and a done, but nothing seems to work :((( of course i dont have just 2 .tif, its just an exemple.

My script:

echo on FOR %%I IN (*.tif) DO (gdal_translate -a_srs EPSG:31983 -of GTiff %%I teste%%I)

pause

Thanks a lot for the help :)

  • 2
    `for ... in (*)` does not get a list of files, but reads them dynamically, so added/renamed files are processed too/again. Avoid with `for /f "delims=" %%I in ('dir /b *.tif') do ...`, which first gets a static list of files before processing each of them. – Stephan Aug 19 '22 at 16:57
  • 1
    …or you change the mask so that it doesn't match the created files, like `utm*.tif` instead of `*.tif`… – aschipfl Aug 19 '22 at 17:35

0 Answers0