1

I want to convert all the .img in a folder and subfolfers to GeoTIFFs.

I do this regularly with gdal_translate for a single file:

gdal_translate -of GTiff input.img output.tif

I'm trying to find out how to run this on the Mac terminal for all the files in a folder/subfolders.

(I have found options for Windows and Linux but not Mac e.g.: GDAL_translate: converting ESRI GRID to Geotiff in batch)

2
  • 2
    Linux answers are applicable to MacOS. find . -name '*.img' -exec zsh -c 'gdal_translate $0 $0:r.tif' {} \;
    – user2856
    Commented Feb 21, 2023 at 3:55
  • 1
    This is not really a GIS question. It's a shell scripting (or other OS-based automation) question. Commented Feb 21, 2023 at 4:32

1 Answer 1

0

The answer suggested by user2856 in the comments worked. Navigate to folder then:

find . -name '*.img' -exec zsh -c 'gdal_translate $0 $0:r.tif' {} \; 

Not the answer you're looking for? Browse other questions tagged or ask your own question.