def syncToPcs(path,remotePath,rPath=""): print "here" if not os.path.isdir(path): return print "here" existFile = {} try: filelist = pcsSDK.getFileList(remotePath+rPath) for fileItem in filelist["list"]: existFile[fileItem["path"]] = fileItem except: pass for f in os.listdir(path): tf = os.path.join(path,f) if os.path.isfile(tf): print f tmpName = pcsSDK.gAppRoot+remotePath + rPath + f print tmpName if tmpName in existFile: print "exist:"+tf else: print "uploading:"+tf pcsSDK.uploadFile(remotePath+rPath,tf) elif os.path.isdir(tf): if len(rPath)==0: syncToPcs(tf,remotePath,f) else: syncToPcs(tf,remotePath,rPath+"/"+f)
def syncToPcs(path,remote,rPath=""): global uploadList if not os.path.isdir(path): return existFile = {} try: filelist = pcsSDK.getFileList(remote+rPath) for fileItem in filelist["list"]: existFile[fileItem["path"]] = fileItem except: pass for f in os.listdir(path): if f[0]==".": continue tf = os.path.join(path,f) if os.path.isfile(tf): tmpName = pcsSDK.gAppRoot+remote + rPath + f if u""+tmpName in existFile: print "exist:"+tf else: print "add to upload:"+tf uploadList.append({"remotePath":remote+rPath,"localPath":tf}) elif os.path.isdir(tf): syncToPcs(tf,rPath+f+"/")