I am unsuccessfully trying to merge all shapefiles in a given directory using QGIS 2.18. I do not want to navigate to the folder using QGIS GUI tools. Instead, I want my script to include all shapefiles in a certain location. For now, what I am getting, is a copy of one random file only. I suppose the semantics of my qgis:mergevecorlayers algorithm is not appropriate.
import glob, os, processing path_to_shp = "C:/Temp/Tracks/" os.chdir(path_to_shp) for file in glob.glob("*.shp"): uri = path_to_shp + fname processing.runalg("qgis:mergevectorlayers", uri, "C:/Temp/Tracks/merged.shp")