First put all the shapefiles you want merged in one directory than I run this bash script in the folder
#!/bin/bash
file="./final/merge.shp"
for i in $(ls *.shp)
do
if [ -f "$file" ]
then
echo "creating final/merge.shp"
ogr2ogr -f 'ESRI Shapefile' -update -append $file $i -nln merge
else
echo "merging……"
ogr2ogr -f 'ESRI Shapefile' $file $i
fi
done
Will put the merged file in a folder named "final" and name it merge.shp. You can change the name of this folder to whatever.
for i in *.shp
is preferable