Trying this from TextMate. Results shown at end. If I copy the result into Terminal it runs fine. Probably something simple. I shortened the paths with ... in this submission
#!/usr/bin/env ruby
require 'shellwords'
InputDirPath = ".../OrthoTIF-3bands/"
OutputDirPath = ".../Ortho-compressed/"
i = 0
Dir.foreach(InputDirPath) do |item|
next if item == '.' or item == '..'
i += 1
name = File.basename(item,"tif")
puts "\n#{i}. gdal_translate -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR #{InputDirPath.shellescape}#{item.shellescape} #{OutputDirPath.shellescape}/#{name}_Compressed.tif"
output = `gdal_translate -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR #{InputDirPath.shellescape}#{item.shellescape} #{OutputDirPath.shellescape}/#{name}_Compressed.tif`
puts output
end
--> 1. gdal_translate -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR .../OrthoTIF-3bands/Bradshaw_Mts.Ortho.tif .../Ortho-compressed//Bradshaw_Mts.Ortho._Compressed.tif
--> sh: gdal_translate: command not found