def copyFile(source, destDir):
    if not source or not destDir:
        return
        
    if os.path.isdir(source):
        newDest = os.path.join(destDir, os.path.basename(source))
        if not os.path.exists(newDest):
            print "cp -R '%s' '%s'" % (source, newDest)
            os.system("cp -R '%s' '%s'" % (source, newDest))
    else:
        destPath = os.path.join(destDir, os.path.basename(source))
        if os.path.exists(destPath):
            sourceTime = datetime.datetime.fromtimestamp(os.stat(source).st_mtime)
            destTime = datetime.datetime.fromtimestamp(os.stat(destPath).st_mtime)
            if sourceTime > destTime:
                os.system("cp '%s' '%s'" % (source, destDir))
        else:                    
            os.system("cp '%s' '%s'" % (source, destDir))
dataset/ETHPy150Open joehewitt/devon/devon/make.py/copyFile/original