Skip to content

Instantly share code, notes, and snippets.

@jamiecook
Created December 1, 2016 00:12
Show Gist options
  • Save jamiecook/ce1008dd2de43b0aa976838bf57b0dfa to your computer and use it in GitHub Desktop.
Save jamiecook/ce1008dd2de43b0aa976838bf57b0dfa to your computer and use it in GitHub Desktop.
list_of_files = IO.readlines(ARGV[0])
def process_file(file, from, to)
layer_name = File.basename(file).gsub(/.tab/i, '')
cmd = "d:/bdk/bedrock/resources/gdal/ogrinfo \"#{file}\""
cmd += "-sql \"ALTER TABLE #{layer_name} RENAME COLUMN #{from} TO #{to}"
`#{cmd}`
end
list_of_files.each { |file|
process_file(file, 'CapB_A', 'Cap_BA')
process_file(file, 'CapA_B', 'Cap_AB')
process_file(file, 'LTB_A', 'LT_BA')
process_file(file, 'LTA_B', 'LT_AB')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment