#!/bin/env python ''' If you have aquired the OS streetview data set and you want to use then in qgis then you will ned to create world files in order import the tiles correctly into your vector layers. This script copies and renames the relevent files into the same directory as the tiff files and so enables correct tiling in gqis Rename files in a folder and copy to new folder. Specifically for OS files for use with qgis. The DEST_DIR needs to be changed to suit your file set before running the script. $Id:$ ''' import os import shutil import fnmatch SRC_DIR = "georeferencing files/TFW" # Change DEST_DIR to suit DEST_DIR = "SN" def process_dir(dir): """process all files in the folder""" for f in os.listdir(dir): if fnmatch.fnmatch(f,DEST_DIR + "*"): filebase = os.path.splitext(os.path.basename(f))[0] shutil.copyfile(SRC_DIR + "/" + filebase + ".TFW", DEST_DIR + "/" + filebase + ".wld") print(SRC_DIR + "/" + filebase + ".TFW" + " -> " + DEST_DIR + "/" + filebase + ".wld") return def main(): """main routine""" if os.path.isdir(DEST_DIR): process_dir(SRC_DIR) return if __name__=='__main__': main()