I'm attempting to iterate through several shape files within a folder and only move some of them to a new folder. I'm doing this based on contents of the DBF file where I'm using dbfread to determine whether is should be moved or not. I have this all working as expected except it's only moving the DBF file and not the .shp, .shx, and .prj. files since the logic is only on the DBF. One way I was thinking I could move all files would be to add the basename of the ones I want to move to a List but I seem to be failing at that. Here is the code I'm using.

I copied your code and filled directory_list with a list of filenames of existing shapefiles. The code worked as expected. Thus I suppose that directory_list contains dbf files only. Unfortunately it is not clear from your code snipped how the list is filled.
– DetlevDec 25 '15 at 20:47

Thanks Digd. For better or worst I wanted to stay away from the shp libraries and just work with the dbf. I didn't end up using the os.path.join part of your script since it was giving me trouble but the other syntax I did.
– wilbevDec 26 '15 at 18:41

With the solution to consider only the content of a dbf files you move only the dbf file.

If you want to move all the files of a "shapefile" (.shp,.shx,.dbf, .proj, ...)
you need to use Python modules processing all the files at the same time as osgeo (GDAL/OGR), Fiona or Pyshp (shapefile) and copy the resulting shapefiles to the new directory

A solution with Fiona (all the results are Python dictionaries) for example

import glob, os
import fiona
MoveFolder_path = r"C:\Data\Move"
for file in glob.glob("*.shp"):
shp = fiona.open(file)
# first feature of the shapefile
if shp.next()['properties']['name'] == None:
# preserve the schema of the original shapefile, including the crs
meta = shp.meta
# copy the shapefile to the new directory
newPath = os.path.join(MoveFolder_path, shp.path)
with fiona.open(newPath, 'w', **meta) as output:
for feature in shp:
output.write(feature)

New

The results of dbfread and Fiona for the dbf files are the same (dictionaries) but the result of Fiona is an generator/iterator with the Iteration protocol (next(),...) and all the all the advantages of the method for large files.

Thanks gene. I wanted to stay away from using any of the shp packages since I was concerned they would add more overhead. Not sure if that would be the case or not but seemed like only working with the dbf may make the script more efficient and faster. Some of the shp/dbf files are rather larger, like over 40MB in size.
– wilbevDec 26 '15 at 18:44