from models import *
from django.core.files import File
from glob import glob

def importFile(filePath, project):
    f = File(open(filePath))
    pi = ProjectImage()
    pi.project = project
    pi.image = f
    pi.caption = ''
    pi.save()
    print "%s saved" % filePath    
    return


def doDir(dirpath, project):
    for f in glob("%s/*" % dirpath):
        importFile(f, project)
    print "all done"
    return
            

