def cleanup(path):
    files = glob.glob(path+'/OUTCyl_*.m')
    for f in files:
        head,tail = os.path.split(f)
        numCylinders = tail.count('-')+1
        if numCylinders == 3:
            newdir = 'ThreeCylPosOpt'
        elif numCylinders == 4:
            newdir = 'FourCylPosOpt'
        elif numCylinders == 5:
            newdir = 'FiveCylPosOpt'
        os.rename(f,os.path.join(newdir,tail))