37,743
社区成员
发帖
与我相关
我的任务
分享def cover_file(originitems, destitems, odir, ddir, client):
updateitems = []
additems = []
for item in originitems:
fpath = ddir + item
dir = os.path.dirname(fpath)
if not os.path.exists(dir):
os.makedirs(dir)
if item in destitems and os.path.exists(fpath):
os.remove(fpath)
file(fpath, 'wb').write(file(odir + item).read())
updateitems.append(fpath)
elif item not in destitems:
file(fpath, 'wb').write(file(odir + item).read())
additems.append(fpath)
if len(updateitems) > 0:
client.checkin(updateitems, '')
if len(additems) > 0:
client.add(ddir,force=True)