0

I'm converting ~100 .hdf files to .tiff using gdal and getting some unfortunate naming conventions when using -sds

for %A in ("...\*.hdf") do gdal_translate -of GTiff -sds "%A" "%A.tiff"

However, it appears that it is first converting the files and then separating the subdatasets, therefore giving me file names like .tiff1, .tiff2, etc (completely useless).

Any suggestions on how to fix this within the same piece of code or with a simple second step?

2
  • There is a ticket for this up on GDAL trac, perhaps some attention there will get a fix committed: trac.osgeo.org/gdal/ticket/5119
    – user10353
    Commented Aug 22, 2013 at 21:36
  • We have submitted this issue to the gdal programming staff and they have fixed the issue within the software. Shouldn't be a problem from now on and should give file names aaa1.tiff, aaa2.tiff, etc rather than aaa.tiff1 and aaa.tiff2
    – Lovette
    Commented Sep 11, 2013 at 14:25

1 Answer 1

1

Found a way to figure this one out in powershell. Using the following code, I was able to just add .tiff on to the end of my files and can rename them later to preserve the naming conventions that I'm interested in.

Set-Location -Path (path)

dir | % { mv $_.FullName ( $_.Name + “.tiff” ) }

Hope this helps others.

1
  • this was fixed in gdal_translate, it will be in the next major release.
    – user10353
    Commented Sep 11, 2013 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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