Small Python tool for cleaning output of pgsql2shp
Thomas Kandler db06392d94 Update 7 years ago Update 7 years ago Create 7 years ago


Small Python tool for cleaning output of pgsql2shp. As the export function of pgsql2shp is writing DBF files even if there is no data in the source it tends to create quite messy folders. This little script will look for empty DBF files and deletes them as well as associated files.

Use case: you got a lot of DB-views which need to be exported to SHP (e.g. for checking by non-DB folks); those views can be empty or not (empty = no error; some data = errors found); the empty ones can be discarded


dbf package; use e.g. pip install dbf to install


  • drop in folder with DBF, SHP, SHX, etc. files
  • run in console


  • add parameter for directory path to clean
  • add parameter for additional extensions (is this needed?)