Very similar to this question Merging multiple .tab files? can someone please help me with a batch script for this?

Based on the answer in the above I have

for i in *.tab;
ogr2ogr -update -append merge.tab i  -f “MapInfo File” -nln merge 

but when I run it it fails with

Unable to open datasource `i' with the following drivers.

and then lists the drivers

  • 2
    I recommend some bash scripting tutorial like linuxconfig.org/bash-scripting-tutorial. I see some dollar signs in the examples.
    – user30184
    Nov 2, 2016 at 12:23
  • 3
    +1 ogr2ogr -update -append merge.tab $i -f “MapInfo File” -nln merge
    – dmci
    Nov 2, 2016 at 12:29
  • Thanks @dmci. That worked. There was an issue with the first " in "MapInfo File" but changed to ogr2ogr -update -append merge.tab $i -f "MapInfo File" -nln merge and all seems good :) Nov 2, 2016 at 13:35
  • Copy-paste can indeed make such trouble. What looks like " may actually be “ which is another character and command fails. The minus sign - is another beast. Writing the command from keyboard usually helps.
    – user30184
    Nov 2, 2016 at 14:32
  • @dmci, sounds like your comment should be an answer.
    – artwork21
    Nov 18, 2016 at 13:17

1 Answer 1


For completeness, and based on the above comments, this should work:

ogr2ogr -update -append merge.tab $i -f “MapInfo File” -nln merge

Your Answer

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

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